onBeforeTaskUpdate

fires before the user updates a task

void onBeforeTaskUpdate(string|number id,object new_item);
idstring|numberthe task id
new_itemobjectthe new (updated) object of the task

Example

gantt.attachEvent("onBeforeTaskUpdate", function(id,new_item){
    //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