We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Overriding task progress of gantt with custom

Hi,
Currently Gantt calculate parent task progress according to its child task. But i want assign progress to every level task on the basis of calculation done by us(according to our logic).

How can i override gantt calculation for progress?

Thanks,
Nivedita

1 Reply

JS Jonesherine Stephen Syncfusion Team March 13, 2017 07:07 PM UTC

Hi Nivedita, 
During load time we can render Gantt with custom progress logic by using “load” and create client side event. Using actionComplete client side event we can update custom progress on add/edit/delete action. 
Please find the code example below: 
$("#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); 
            } 
        }      
We have prepared the sample and rendered Gantt with custom progress. Please find the sample from below location 
If you are facing any issues while rendering Gantt with your custom progress logic kindly revert us with your exact requirement. This would be helpful for us to serve you better. 
Regards, 
Jone sherine P S 


Loader.
Live Chat Icon For mobile
Up arrow icon