jstree version 3.1.1, plugin dnd.
I need to drag nodes in one jstree element and drop them to another jstree element. This is working fine and i get all information about the element which is dragged, but I don't get any information about the dropped (newly) created node in the second jstree element.
dnd_stop.vakata seems not to contain this information (at least i can't find it), create_node.jstree isn't triggered, when dnd creates a new node, so i wonder how to get the id of the new node.
Please check this one: http://jsfiddle.net/amug08ms/
all needed code is in the example ...
When you drag a node from the upper jstree to the lower jstree, all information about that node is lost, except the text of the node. So how can i add the information i need to the dropped (created) node in the lower jstree node?
Thanks for any hint in advance!
The event that is triggered when using multi-tree drag'n'drop is copy_node.jstree
.
Here is how you can transfer the ID (using this example it should be easy to copy any other properties you may need - by default IDs and data is not copied):
$('#destTree').on('copy_node.jstree', function (e, data) {
data.instance.set_id(data.node, data.original.id);
for(var i = 0, j = data.node.children_id; i < j; i++) {
data.instance.set_id(data.node.children_d[i], data.original.children_d[i]);
}
});
Here is the updated fiddle:
http://jsfiddle.net/amug08ms/1/