Articles in this section
Category / Section

How to specify the scope of drag-and-drop area in TreeView?

1 min read

In our TreeView component, the draggable module has been bound on tree element to provide the 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;
       }
    }

 

Sample: https://stackblitz.com/edit/angular-occhvv-t8rc18?file=node-editing.html

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied