PDA

View Full Version : Moving TreeNodes between TreePanels/Nodes



n3b
11 Mar 2010, 3:44 AM
Hello - I'd like to know if it's possible to easily move TreeNodes between distinct TreePanel / TreeNode instances.

What I've tried doesn't work as I would expect it to:
assume I already have a properly configured tree called mytree1

approach one:

instantiate a new treenode using an existing childnode:


var mytree2 = new Ext.tree.TreeNode(mytree1.childNodes[0]) //fails to take on node config

approach two:

try to create an empty tree then append a node


var mytree2 = new Ext.tree.TreeNode({text: "new tree"})
mytree2.appendChild(mytree1.childNodes[0]) // fails

I suspect I'm missing a trick here. Possibly with the TreeLoader? any pointers welcome
Cheers,
n