-
5 Oct 2010 7:54 PM #1
Moving AsyncTreeNode to a new parent
Moving AsyncTreeNode to a new parent
I have tree structure like below using AsyncTreeNode and a treeloader
root
+-item1
+----item2
+------item3
Is it possible to replace item2 with a new node and then change item2 parent to the new node to have something like below without going through all the nodes or reloading the tree
root
+-item1
+----newnode
+------item2
+--------item3
I tried just swapping parent node but without success.
Code:newnode = new Ext.tree.AsyncTreeNode(attributesofnewnode); var item2= item1.firstChild; //gets item2 item1.appendChild(newnode); item2.parentNode = newnode;
-
6 Oct 2010 1:13 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
You are not allowed to change parentNode (it's defined as read-only).
Just use appendChild again, e.g.
Code:newnode.appendChild(item2);
-
6 Oct 2010 6:21 AM #3
-
6 Oct 2010 6:36 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
item3 is a child of item2, so it should be moved together with item2! Are you saying that it doesn't?
Or does item1 have more children that need to be moved to newnode? That you have to do yourself.
-
6 Oct 2010 6:48 AM #5
item3 is a child of item2 and its not being moved. Actually there could be item3 child of item2 and item4 child of item3 etc... They are AsyncTreeNodes. Could that make a difference?
-
6 Oct 2010 7:21 AM #6
Actually I should be more precise. Item3 is not being moved and it actually disapear totally from the tree right after I append item2 to the newnode
Similar Threads
-
[CLOSED]TreeStore.add(parent, child, true) not adding child to parent.getChildren()
By Cputerace in forum Ext GWT: Bugs (2.x)Replies: 1Last Post: 29 Jun 2009, 9:20 AM -
Moving Element to a different parent
By ben_dog in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 9 Sep 2008, 4:57 AM -
Search Parent of parent
By AlainJS in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 7 Apr 2008, 5:32 AM -
child = new Ext.Panel({ renderTo: parent.body.id }) vs parent.add(child)
By elDub in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 28 Nov 2007, 9:02 AM -
Moving a node from an iframe to parent - IE problem
By dustismo in forum Ext 1.x: Help & DiscussionReplies: 0Last Post: 30 Aug 2007, 11:58 AM


Reply With Quote