onAfterTaskAutoSchedule event and updateTask()

If I programatically update a task with links on it and the parent gets adjusted only a “onAfterTaskUpdate” event is triggered on the task I updated. No event is generated for the parent. Is this expected? Is there something I need to change?

You can recreate this on the Auto Scheduling sample page using Chrome Dev Tools.

First, put this into the console so you can see the events triggered:

gantt.attachEvent("onAfterAutoSchedule", function() { console.log("onAfterAutoSchedule",arguments); }); gantt.attachEvent("onAfterLinkUpdate", function() { console.log("onAfterLinkUpdate",arguments); }); gantt.attachEvent("onAfterTaskAutoSchedule", function() { console.log("onAfterTaskAutoSchedule",arguments); }); gantt.attachEvent("onAfterTaskDrag", function() { console.log("onAfterTaskDrag",arguments); }); gantt.attachEvent("onAfterTaskMove", function() { console.log("onAfterTaskMove",arguments); }); gantt.attachEvent("onAfterTaskUpdate", function() { console.log("onAfterTaskUpdate",arguments); });

Next, run the following code to update Task #2.1 to 1 day earlier, which shifts the parent (Task #2)

var t = gantt.getTask(17); t.start_date = new Date("04/02/2013"); gantt.updateTask(17);

One onAfterTaskUpdate event is all that is generated.

Also, if you apply the event listeners from my post and do the same operation of dragging the start date one day earlier you also don’t get any updates about the parent being updated.

there are two different parts of task scheduling

  1. The time of the project is adjusted to the times of nested tasks
    docs.dhtmlx.com/gantt/samples/01 … tones.html

  2. Setting time of task via Auto scheduling extension
    docs.dhtmlx.com/gantt/samples/02 … uling.html

  • task can be automatically moved due to relations constraints.
    The later can trigger AutoSchedule events.

When you move task to earlier date, the parent project gets automatically extended without autoscheduling involved, so the related event are not fired.

The onAfterTaskUpdate wouldn’t be called for a parent project as well. This happens because currently project are expected to have dynamic dates (client not uses project date from the datasource, if there is any, but calculates it from nested tasks), so it also does not send changed date back to the server.

Can you please clarify your use case and the issue, so we could figure some solution or a workaround?