Category / Section
How to specify the scope of drag-and-drop area in TreeView?
This article explains how to specify the scope of the drag-and-drop area in TreeView.
In our TreeView component, the draggable module has been bound to the tree element to provide drag-and-drop support. So, you can access this module using the getModuleName method to find the draggable modules and specify the dragging area for tree nodes using the dragArea property of the draggable module. The following code sample demonstrates how to specify node dragging area in TreeView.
let treeElement: any = this.treeview.element;
// Get all the TreeView element instances
let instances: any = treeElement.ej2_instances;
for (let i = 0; i < instances.length; i++) {
// Validate whether the instance is draggable
if (instances[i].getModuleName() == "draggable") {
// Specify the dragging area for tree nodes in TreeView
instances[i].dragArea = ".control_wrapper";
break;
}
}
Refer to the working sample for additional details and implementation: Sample