during a task drag, there is a default mecanism that rounds the date to the closest (?) date after the onBeforeTaskDrag event.
This is ok with a zoom level where grid corresponds to days.
But if there is a higher zoom level ( weeks ), the tasks dates are correctly changed during the drag, but when the drop happens, the dates are rounded to fit the closest grid, which corresponds not to a day rounding, but to a week rounding.
I can’t find a way to disable or modify this behavior.
I have found that the example works wrong on “non-standard” zoom level.
The reason is - children dates are rounded not to the gantt.config.duration_unit/step, but to the current unit/step which results in children sticking to the current grid even if the parent task was moved by a diff less than one current unit.
I.e. if you have gantt.config.duration_unit = day, but current grid has unit/step = 1 week, if you move the parent task in the middle of the week cell, its children start dates are moved to the next or current week start date which is obviously wrong.
Proper example should be: child.start_date = gantt.roundDate({date: child.start_date,unit: gantt.config.duration_unit,step: gantt.config.duration_step});
Can you help me with a sample of code to fix this beahavior ?
However, we are aware of the issue that if you drag a project with its subtasks in the year or month view, the distance between tasks will not be saved: https://snippet.dhtmlx.com/5/79bf505b1
Unfortunately, we don’t have a fix for that.
Hello Julien,
The dev team fixed the bug with the drag_project functionality. Now, if you drag a project task in the month scale, it shouldn’t affect the duration of the project task or its subtasks. Also, the tasks should keep the distance between them: https://docs.dhtmlx.com/gantt/whatsnew.html#719
Hi,
this doesn’t seem to be working for nested projects in version 7.1.13
When dragging a project that contains other projects the tasks inside of these don’t retain their duration and distance in between.
Do you know if this is solved in later versions? And is version 8 stable?
Hello Obralink,
I added the code to the snippet with the 7.1.13 version, but the issue is not reproduced when I drag Project #1 that has nested project tasks: https://snippet.dhtmlx.com/noh8btar
If you can reproduce the issue in the snippet, please give me the steps to do that.
Or you can add your configuration to the snippet and make sure it is reproduced there. Then you can click on the Save button and send me the link.
The 8.0 version is stable, and the recent bugfix updates added performance improvements.
As some dates may appear on the weekends and the project dates depend on child tasks, its duration can change while you drag it. This is expected behavior. After you finish dragging the task, Gantt will round the duration to the nearest hour, so the project task will have the correct duration.
Another issue is related to a different bug that has not yet been fixed.
You only need to enable auto-scheduling to reproduce that bug, and you need to drag a project task to an earlier date several times: https://snippet.dhtmlx.com/g6t0xe4d
The issue occurs because Gantt adds the constraints to the child tasks, but only the first task receives the correct constraint. The constraints of other tasks are not updated.
As a workaround, you can remove the constraint dates while dragging the project task: