Order branch (task drag and drop) just for type which is not project,


#1

Hey,
I want to make the make order branch available and I can achieve that by:

gantt.config.order_branch = true';

It works as it should, the tricky part for me is that I want to make this available just for tasks (not type project).

This means that tasks can be dragged into any project but projects cannot be dragged into different projects.

There is any way to achieve that?

Thanks.


#2

Hello Adir,
You can use the onRowDragStart event handler to cancel the vertical reorder drag:
https://docs.dhtmlx.com/gantt/api__gantt_onrowdragstart_event.html
There, you can check if a task has children:
https://docs.dhtmlx.com/gantt/api__gantt_haschild.html
Here is an example of how it can be implemented:
http://snippet.dhtmlx.com/5/a59f8cd53

Or you can check the task type to allow dragging regular tasks with subtasks:
http://snippet.dhtmlx.com/5/a2d12f759