View Full Version : Copy a node from one tree to the other without removing it from the original

11 Feb 2010, 3:10 AM
Anyone have solutions: how to move a node form one tree to another tree, without removing from original place....

Aryan Gupta

11 Feb 2010, 6:17 AM
How about creating a new TreeNode in the second tree and copying the original node's attributes to it?

11 Feb 2010, 7:01 AM
You should probably read this thread here: http://www.extjs.com/forum/showthread.php?t=26644

That will detail all the problems that occur from trying to do the "Right Thing(TM)".

Hence, you should probably do what the above poster recommends:

var node = yourTree.findNodeById( ... );
var newNode = new Ext.tree.TreeNode( { id: node.id, text: node.text, leaf: node.leaf } );
// and then of course you'll need to match hierarchies and figure out the appropriate spot to add

obviously i haven't tested any of this, just a concept :p