PDA

View Full Version : Tree nodes gets displayed twice.



herat007
14 May 2013, 3:47 PM
Hi ,
I am creating a tree in a form panel. So when i first save that data in the form panel including input i have given to the tree. It gets saved to the backend.. While on editing that form data, I get the tree nodes to be displayeed twice.
For eg: I have a tree
Node1
|- subnode1
|- subnode2
Node2
|-subnode3
|-subnode4


Node these Nodes are replicated while editing the form data.
What I am doing is that I am calling formPanel.load(function(){
// where i am again calling

tree.getLoader().load(tree.getRootNode(),function(){
//something i do to the tree..
},
}

somehow there is a timing issue here which i am not able to figure out. Can anyone help me its urgent.

Thanks in advance.
Herat

herat007
20 May 2013, 7:21 AM
Please help me out here.. Kinda stuck on that.

dracofyre
20 May 2013, 10:22 AM
It is probably because you aren't clearing the children on load.

Take a look at:
http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.tree.TreeLoader-cfg-clearOnLoad

herat007
20 May 2013, 10:35 AM
It doesnt work :( . It says it defaults to true. I havent set any property like that. So it should default to true .

dracofyre
21 May 2013, 3:51 AM
Without any code, its kinda of difficult to provide any good feedback. Use chrome or firebug and step through the load method. You should see the root node's children be removed in the first call. If they are then, your problem is probably related to your data.