我需要动态地向剑道甘特图添加行(有点像添加新任务)。我正在将新行添加到 dataSource,但新添加的行未反映在 UI 中。我尝试刷新甘特图,但没有运气。添加 k-rebind 有效,但我不想使用 k-rebind 选项。
plunker:http ://plnkr.co/edit/D5TZlsrUS9XX2nV6WOFe?p=preview
function injectRow() {
$scope.myGanttOptions = ganttServices.injectRow($scope.myGanttOptions);
console.log($scope.myGanttOptions); //$scope.myGanttOptions is having the newly injected row, but it is not seen in the UI.
// refreshing the gantt chart does not inject the row.(even after trying it in timeout)
$timeout(function() {
$('#ganttID').getKendoGantt().dataSource.read();
$('#ganttID').getKendoGantt().refresh();
},100);
}