Hello,
Can you please tell me a way of getting the real destination path for a moved node in a tree in the "nodeDropping" or "nodeDropped" events?
I ve got the initial path in the "nodeDropping" event and it's ok in all test cases.
I was expecting that at least i can rely on ui.targetIndex from "nodeDropping" to get the index of the destination, but it has an unexpected behaviour:
-if you move the node at the end of the tree, targetIndex will indicate 1 position to short
Also, i tried getting new node at it's new location with ui.element, but failed.
Is there a way of getting the real destination path or the new node at it's new place (after being moved)?
Nicusor Eftene
Hi Nicusor Eftene,
Thank you for posting in our forums!
I am looking into how to access the path of the newly dropped node for you and I will need a little more time to complete my research.
I will have another update on this for you tomorrow.
Ok, please note that i ask as an user of 14.2 ignite ui version. Older version act slightly different.
Thank you for the update. I am currently discussing this issue with our developers.
I will let you know when I hear back from them with the information they provide.
Hello Nicusor Eftene,
I have received the following information from our developer:
When a node is dragged and dropped the tree performs adding a new node and removing the old node. We actually have an internal event you can subscribe to in order to be notified when a new node is added. This event is not documented because it was included for the purpose of notifying extensions like the igTree knockout extension about the tree adding a node.
this._trigger("nodeAdded", null, {owner: this, element: li, data: node, index: nodeIndex, binding: binding});
The event arguments are the following: owner: the tree element: reference to the new node element (jQuery object) data: reference to the node data object index: index where the node was added binding: the tree bindings at the node level where the node was added
You can use this event and you will get it fired every time with drag and drop.
I have also put together a jsfiddle that demonstrates subscribing to this event and displaying the new path of the dropped node.
If you need further assistance with this, please let me know.