How to send data to the server only when there is a real modification?

If I move a task and drop it in the same place, it is sent to the server. When a link exists and drags the task, the link corrects and pulls the task back to where it was. How can I prevent it from sending to the server what was not actually modified? Is the current behavior correct?

Hi @douglas!

You can compare the task’s start_date values using arguments of the callback function of the onBeforeTaskChanged event and return false if they are the same.

Please check the snippet how it can be implemented:

1 Like

When I move a task, it works fine. But when I move a ‘project’ to another date, the subtasks are not updated. I saw in the console that the old date and the current date are the same in the subtask. How to solve this?


Hi @douglas!

If you use gantt.config.drag_project=true then please add checking task type in the condition of canceling the task’s update:

if (task.type == "project" && mode == "move" || mode == "resize") {

Here is a snippet:

Maybe I was not clear.
When I move a ‘project’ to another date, the subtasks are not updated on the server. See the video.

Hi @douglas!

It appears to be a bug on our end using gantt.config.drag_project=true;. I’ve submitted it to our internal tracker, and the dev team will start fix it and it will be published with one of the next bugfix releases.

As a workaround for the issue you can check the type of the task in the onAfterTaskDrag event listener.

And if its type is project update its children tasks.

Here is a snippet you can see how it can be implemented:

Note I’ve also modified date values camparing and added it in the compareDateValuesToSimilar() function.

1 Like

Hello Douglas,
I couldn’t reproduce the issue in the current version:
Could you clarify if the bug still affects you?