PDA

View Full Version : moving node elements into a treepanel



pyr0l0
28 Nov 2007, 9:53 AM
Hi,
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.

new2ext
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:
http://extjs.com/deploy/ext/docs/output/TreeDropZone.jss.html

KJedi
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');
newParent.appendChild(node);

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.