DevExtreme v23.1 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.
Tree List

Node Drag & Drop

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:

  1. Allow users to reorder nodes
    In the rowDragging object, set the allowReordering property to true. You can use the "Allow Reordering" checkbox under the TreeList to try this property.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

Thank you for your interest in our ASP.NET Core product libraries and UI component suite. We are moving ASP.NET Core-related demos and content to Please make sure to update your bookmarks with our new URL.

View Demo