onBeforeTaskUpdate

fires before the user updates a task

void onBeforeTaskUpdate(string|number id,Task new_task);
idstring|numberthe task id
new_taskTaskthe new (updated) object of the task

Example

gantt.attachEvent("onBeforeTaskUpdate", function(id,new_task){
    //any custom logic here
});

Details

While using the onBeforeTaskUpdate event, it is not always possible to get the object of the task before the task is completely updated. The event fires after the task object has been updated but before all changes have been applied. To get the task object before the changes are applied, you need to use the event handlers which are directly related to the changes of the task:

If the changes are made via API, you may get the task object before the code, which modifies the task, is executed. Check the example where you may modify a task in different ways (for instance, change the task dates):

Related sample:  Updating a task

After comparison, you will notice that the events, which fire right before you modify the task, return the old task object, while the onBeforeTaskUpdate event returns a new object of the task.

See also
Back to top