phphe/he-tree

How to undo a drag change?

Closed this issue · 1 comments

Thanks for this library!

I drag a node to a new position in the tree.

In some situations, eg if a backend call fails, I may want to revert the change.

Currently the only way to do this that I can see, is to programatically call move after the change event has fired. Something like this:

const { indexBeforeDrop, parent } = dragContext.startInfo
treeEl.value.move(activeStat.value, parent, indexBeforeDrop)

But this seems complicated, and I couldn't find anything in the docs about this.

What is the recommended way to revert a change?