About Dragging Lines

Hello,
I am using Suite Pro and developing drag and drop functionality in a tree table. I have also made some configurations and functional logic, hoping to achieve some control
I have the following requirements:

  1. Only allow drag and drop of tasks at the same level
  2. Only allow dragging and dropping under the same parent task
  3. Dragging only allows for forward and backward insertion, and cannot be set as a child
  4. Dragging and Carrying Descendants Task

I demonstrated the above functionality through custom logic using the before RowDrop and after RowDrop methods.
I would like to inquire if there is a better method or parameter that I have not discovered to meet this requirement.
The configuration reference is as follows

        dragMode:  'both'
        dragItem:  'row' 
        dragPanel:true,
        dropBehaviour:  'sibling' , 

Thanks
Looking forward to the answer

Hello @ttq,

Thank you for the detailed description of the requirement.

Likely it can be solved with sibling drop behaviour(same level), and additional check in the beforeRowDrop in order to forbid changing parents after drag.

Something like follows:

function rowDropAllowed(d) {
    if (!d.target || d.start === d.target) return false;
    const data = grid.data;
    return data.getParent(d.start) === data.getParent(d.target);
}


grid.events.on("beforeRowDrop", function (d) {
    return rowDropAllowed(d);
}); 

Here is an example:
https://snippet.dhtmlx.com/na8tuvtv

Kind regards,