Autoscheduling does not send all changes at once


#1

Hello,

I have a three staged Gantt, which means that when moving one project a couple dozen tasks and subprojects are updated.

The problem is that all those individual tasks are sent individually over AJAX, meaning that after moving a project the window freezes for a couple seconds.

I’ve looked into the code a bit and see that in _finalizeAutoSchedulingChanges() the variable batchUpdate() is set – so I would assume that all tasks are in fact sent as one. However this is not the case.


#2

Hello,
Usually, you just need to specify the second parameter as true in the setTransactionMode:

dp.setTransactionMode("POST",true);

But that works only when the transaction mode is POST.
After that, Gantt will send one request after you update a task, then 1 more request with other tasks data.

If you need to add custom conditions, you can try implementing it using Data processor API:
https://docs.dhtmlx.com/api__refs__dataprocessor.html


#3

Hmm, that does not seem to do the trick.

I have created a snippet, but because I use the autoschedule functionality it doesn’t really work. So you have to replace the link to that plugin.

I also have choosen httpbin.org as my API endpoint, which doesn’t return anything but is ok because the problem is on the sending side.


#4

Hello,
Thank you for sending the snippet. I see that there are 2 cases: project drag and autoscheduling, both updating several tasks. So, you can use a variable in the “onBeforeUpdate” event handler to control if you need to send the data or not.
In the “onBeforeTaskDrag” event handler you check if the dragged task has children and disable sending the changes. After dragging ends, you enable sending the data and use dp.sendData() function to send all changes at once. Here is the snippet:
http://snippet.dhtmlx.com/df5b3927e
Similarly, you disable sending the data in the “onBeforeAutoSchedule” event handler, and enable that in the “onAfterAutoSchedule” event handler:
http://snippet.dhtmlx.com/ebeaff099