vakata / jstree

jquery tree plugin
http://jstree.com
MIT License
5.15k stars 1.38k forks source link

When a node is moved between two trees, move_node.jstree event is not triggered. #2571

Closed kelvinkawaiho closed 3 years ago

kelvinkawaiho commented 3 years ago

Problems:

1) When a node is moved between two trees, move_node.jstree event is not triggered. However, if I move the node within the same tree, the move_node.jstree is triggered. 2) After the node is moved between two trees, not all the content of the node is moved, e.g. ID in the new tree is changed (I can understand this part because the target tree may already have this ID already). However, I have "data" : { "abc" : "edf" }, the data node from the source tree is also not copied over to the target tree.

Basically, I can only see the "text" node moved over.

Thanks for taking a look.

vakata commented 3 years ago

jstree does not move between trees, it copies - listen for the copy_node event (there is also indication in the event data if it is a multitree event). As for the data - I am afraid you have to handle this yourself in the event handler. It is usually a matter of iterating over descendants in the origin tree and copying/referencing data in the destination tree.