$("#GanttContainer").ejGantt({
actionComplete: function (args) {
//To update the parent fields on edit action
if (args.requestType == "recordUpdate" && !progressEdit) {
update(args.data.parentItem);
}
//To update the parent fields on add action
if (args.requestType == "save" && args.addedRecord) {
update(args.addedRecord.parentItem);
}
//To update the parent fields on delete action
if (args.requestType == "delete") {
update(args.data.parentItem);
}
},
});
function update(parentItem) {
if (parentItem != null) {
//custom logic for parent item
parentItem.status = Math.round(parentItem.status +2);
parentItem.progressWidth = (parentItem.width * parentItem.status) / 100;
var ganttObj = $("#GanttContainer").data("ejGantt");
treeGridObj = ganttObj._$treegridHelper.data("ejTreeGrid");
ganttChartObj = ganttObj._$ganttchartHelper.data("ejGanttChart");
ganttChartObj.refreshRow(ganttChartObj.model.updatedRecords.indexOf(parentItem));
treeGridObj.refreshRow(treeGridObj.model.updatedRecords.indexOf(parentItem));
return update(parentItem.parentItem);
}
} |