View Full Version : Tree: nodedrop event

19 Mar 2010, 6:39 AM
This is probably an easy question and the answer's probably staring me right in the face.. but.. On a nodedrop, how do I glean the previous (source?) parentNode of the node that's being dropped from the dropEvent object.

19 Mar 2010, 7:32 AM
Have you tried its parentNode property?

19 Mar 2010, 7:33 AM
No, that will be its new parent. In the beforenodedrop handler, it will still have its old parent.

19 Mar 2010, 7:34 AM
dropEvent.dropNode.parentNode is returning the NEW (target) parent

23 Mar 2010, 2:35 PM
Sorry mcahill81, but Animal is right on this one. If you output a dropEvent.dropNode.parentNode within beforeNodeDrop handler and the same within nodeDrop handler, you will get different parent nodes (obviously only if you drag'n'drop to a different parent).

I actually tried it myself because I am performing some validation in these handlers and needed a way to restore dropNode's original location when validation fails.