Drag a task to an unexpanded project

Drag a task to an unexpanded project . Event ‘’onRowDragEnd‘’ is dragged to the expanded item. Please help me thank you.

Hi @nidemifan,
If I understand you correctly, you want to be able to drag tasks inside “unexpanded” projects, am I right?
You can implement it using this config:

gantt.config.order_branch = "marker";
gantt.config.order_branch_free = true;

Here is a demo:

In this case, it also will be available to drag tasks to another task(without children), and the dragged task will become its child. You can forbid this scenario using the “onBeforeRowDragMove” event, the code may look like this:

gantt.attachEvent("onBeforeRowDragMove", function(id, parent, tindex){
  if(parent != 0){
    var parentTask = gantt.getTask(parent);
    if(parentTask.type != "project"){
      return false;
  return true;

If it is not the thing you need, could you please clarify the question?

API: onBeforeRowDragMove:

Hi Siarhei. thanks your answer.

1 Like