Drag and Drop with ZTree


Have you used the Drag and Drop property of the Ztree component?

In my structure I have a property called ORDER, this property will store the order of each parent node in my tree.

[Node 1: ORDER = 1

  Node 2: ORDER = 2

  Node 3: ORDER = 3

  Node 4: ORDER = 4]

After moving any node up or down, I would like to get the node value and thus save that new position value in my ORDER property.

Currently I can already have Drag and Drop. What happens... that is not saving the position.

Do you have any experience of how I can implement with ztree?


Hi Danilo, 

I implemented an example of how to get the element that is being dragged and where it was dropped.

See the attached oml.

Changes were made to the beforeDrop callback settings.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.