PDA

View Full Version : clearOnLoad in a treestore problems (how to load the same node twice as child)



deepaExtJs
7 Nov 2012, 12:30 PM
I have to load a tree in which the child nodes are the same for many parent nodes.
Eg
parent1
|
--child1
|
parent2
|
--child1
--child2
|
parent3
|
--child2
--child3
and so on.
I have created an Ext.data.treeStore and am loading the children by chnaging the url in the beforeload listener.
Now the problem is, my store removes all duplicates(i cannot load child1 twice onto the store) and hence am not able to expand my tree
Note that the following works
parent1
|
--child1
|
parent2
|
--child2
|
parent3
|
--child3
I ahve tried setting clearOnLoad to false and a few other things but not getting anywhere.
Any input and directions would greatly help! please

Thanks

James Goddard
7 Nov 2012, 12:49 PM
You cannot have two items in the same tree with the same id. If you need to have the same item in multiple paths in the tree it will have to have a unique id for each instance.

deepaExtJs
14 Nov 2012, 1:49 AM
that helps. I have changed the model to return nodes with unique ids even though their content is the same.
I am suprised a treestore cannot have same child nodes in the store!