PDA

View Full Version : Problem when try to insert an node into a treepanel



wallynm
10 Jan 2012, 9:45 PM
Hello for everyone... I'm having some headcaches with trepanels, but finally i almost done with my problems, now i'm needing help on this:

When i try to isnsert a node into an treepanel, the node it's inserted correctly, actually i'm using this code to insert a node to the tree:


var rec = {
nome : 'teste' ,leaf : true
}

var treeGridAppend = this.gridCmp.getRootNode().findChild(property, val, true);
var appended = treeGridAppend.appendChild(rec);


Everything it's fine untill here, when this code runs the node it's appended to the tree, BUT i'm with problems when i try to insert a node into a LEAF node... when the node is inserted into an leaf, it remains as a leaf and the new child element isn't appear...

There's a way to change the Leaf property to false?
Or maybe some type of doLayout function?

wallynm
11 Jan 2012, 8:25 AM
Someone?

wallynm
11 Jan 2012, 11:10 AM
Thanks for God, he helped me to get the result... it was simple to solve, but other people would need it, so here is the answer:

When i was trying to insert an new child on a leaf, the item was inserted without any trouble, but the new item wasn't appering, so i just added an validations to verify if the item isLeaf them if it is true, i just change the leaf property to false, as it will have a child now...


if(treeGridAppend.isLeaf() == true){
treeGridAppend.data.leaf = false;
}


:D

JAD1951
26 Jul 2013, 10:04 AM
For the ExtJS v4.2 this is a mistake of interpretation inside the title of this post : you append a new node to a parent node == you place it like a new lastChild. This is not the same for the insert node. I would like to insert a new node (newNode) just under a parent node (parentNode) - my new node should be became a firstChild of the parentNode. But I don't know how I can do it ? Any idea ?

Best regards

JAD1951

JAD1951
26 Jul 2013, 10:05 AM
For the ExtJS v4.2 this is a mistake of interpretation inside the title of this post : you <u><strong>append </strong></u>a new node to a parent node == you place it like a new lastChild. This is not the same for the insert node. I would like to insert a new node (newNode) just under a parent node (parentNode) - my new node should be became a firstChild of the parentNode. But I don't know how I can do it ? Any idea ?<br>
<br>
Best regards<br>
<br>
JAD1951