The TreeList allows users to drag and drop nodes. Use the icons in the leftmost column as the drag handles.
To configure node drag and drop, follow these steps:
Allow users to change the node hierarchy
Enable the allowDropInsideItem property to allow users to drop one node onto another, thus adding it as the target node's child. If the property is disabled, users can only drop nodes in between others. You can use the "Allow Drop Inside Item" checkbox under the TreeList to try this property.
Reorder nodes in code
In the onReorder function, change the parent ID of the reordered node and the node's index in the data array. If the node was dropped onto another node, changing the parent ID is sufficient. Refresh() the TreeList after these manipulations.
Prevent a node from being moved inside its child node
Moving a parent node inside its own child node breaks the hierarchy. Prevent this situation in the onDragChange function. Cycle through the target node's parents. If the parent's and source node's IDs are equal,
cancel the ability to drop the node.
Show or hide drag icons (optional)
Users use the icons as drag handles. To hide them, set the showDragIcons property to false. In this case, the drag handles are the rows themselves. Use the "Show Drag Icons" checkbox under the TreeList to try this property.