I have a syncfusion treeGrid component with drag and drop activated. When a component is dropped I would like to know what row is gonna be the parent after the drop (what's the new parentId).
2 Answers
Searching the documentation, you have these events that fire from drag and drop actions. Sounds like you want to listen to rowDrop
event. This event will provide these event arguments, of which I think you want dropIndex
property. With the index of the row dropped on you should be able to look up the id and other information in your rows data array.
From using getCurrentViewRecords method, we can get the ParentItem or ParentID of the dropped Child with Children property of that record and if it is dropped as Parent, ParentItem remains undefined. You can get the details from actionComplete event of the TreeGrid after rowDrag and drop operation.
Refer to the documentation lInk: https://ej2.syncfusion.com/vue/documentation/api/treegrid/#getcurrentviewrecords https://ej2.syncfusion.com/vue/documentation/api/treegrid/#rowdrop

- 30,962
- 25
- 85
- 135

- 16
-
but is there any way of knowing it before completing the action?. The rowDrop event has a dropIndex but that's related to the tree index and not the row's ids. Also the row corresponding to rowIndex on the tree isn't always the new parent of the dropped row. – Joaquín Laks Sep 16 '22 at 20:30