Treeview Drag and Drop Position property

When dragging and dropping a Treeview node the NodeDropped event includes a "position" property should be either "Before", "After", or "Inside" according to the documentation, however the "Inside" position type is never triggered. How can I determine if the node was dropped as a sibling or a child of the DroppedNode?


1 Reply

IL Indhumathy Loganathan Syncfusion Team September 26, 2022 08:23 AM UTC

Hi Jason,


Greetings from Syncfusion support.


We understand that you want to retrieve the position value on node dropping. We would like to let you know that we have nodeDragStop event which will trigger when the TreeView node drag (move) is stopped. But the nodeDropped event will trigger when the TreeView node is dropped on target element successfully. So to retrieve the proper position value we suggest you use the nodeDragStop event. Check the below code snippet.


  nodeDragStop(args) {

    console.log('NodeDragStop');

    console.log(args.position);

  }

...

<TreeViewComponent

  fields={this.fields}

  allowDragAndDrop={this.allowDragAndDrop}

  nodeDragStop={this.nodeDragStop}

/>


Sample: https://stackblitz.com/edit/react-mr8eqx?file=index.js


Please check the sample and let us know if you need any further assistance.


Regards,

Indhumathy L


Loader.
Up arrow icon