View Full Version : Appending Tree Node to Specific Position Instead of Bottom

6 Apr 2010, 12:58 PM
I have a TreePanel with Drag and Drop working nicely. I'm listening for node appending and node dropping events on the tree panel and updating the positions of nodes in my data models as they're moved.

Only issue I have, when a tree node is appended to an existing node, by default it gets inserted as the last child of the parent node. This is the default behavior of TreeNode.appendChild. What is the correct way to intercept that action and change the index position of the new node, so I can control it's position before it's appended?

The end goal is the have nodes appended show up at the top instead of the bottom.

I can see the index position by listening to TreeNode.append, but I'm not sure how to change it at this stage or before this event fires.

Thanks in advance!