View Full Version : moving node elements into a treepanel

28 Nov 2007, 9:53 AM
I would like to take control over some features (drag&drog nodes and folders) into the same TreePanel.
How can I move a folder into another folder PROGRAMATICALLY preserving all attributes of each element?

Thanks a lot.

28 Nov 2007, 2:55 PM
You have to override the event functions of the TreeDropZone component (dropZone property) of the TreePanel. Take a look at the source to find what you need:

16 Feb 2008, 9:53 AM
If you want just to move node to another, simple appendChild() it.
See pseudocode:

var node = tree.getNodeById('node1');
var newParent = tree.getNodeById('newPar');

This moves the node to another parent. The same will occure if you call insertBefore, insertAfter etc.

If node is present anywhere in the tree and you add it to another location, it is simply moved to the new location.

I don't know why to mess it up not creating move() method, but the above code should work well. It works OK for me.