gantt
                                
                                 gantt copied to clipboard
                                
                                    gantt copied to clipboard
                            
                            
                            
                        The progress bar cannot be updated automatically, after modifying the start and end times
The progress bar cannot be updated automatically, after modifying the start and end times
Hello,
As I understood your question correctly, you want to update the progress bar of the task after its duration changes (for example, if the duration is 2 days and progress is 50%, so after changing the duration to 4 days, the progress of the task should change to 25%). To get this functionality, you can use onBeforeTaskChanged event:
https://docs.dhtmlx.com/gantt/api__gantt_onbeforetaskchanged_event.html ;
In the beginning, you need to use getTask method that will return the current task object (with new data of the dragged position):
https://docs.dhtmlx.com/gantt/api__gantt_gettask.html ;
To calculate new progress, you need to divide original progress by current duration and multiply by previous duration of the task:
 let currentTask = gantt.getTask(id);
 let originalProgress = currentTask.progress;
 let progressStep = originalProgress / currentTask.duration;
 let newProgress = progressStep * task.duration;
 currentTask.progress = newProgress;
 gantt.updateTask(id);
and update the task by updateTask method:
https://docs.dhtmlx.com/gantt/api__gantt_updatetask.html ;
The same logic will be applied to onLightboxSave event, only the getTask method will return the original task object (values aren't applied to the task object yet):
https://docs.dhtmlx.com/gantt/api__gantt_onlightboxsave_event.html ;
Please check the following snippet:
https://snippet.dhtmlx.com/lpitgh8t