PDA

View Full Version : Set root with child nodes in treestore



Yazla
21 Mar 2014, 9:22 AM
Hi guys,
I have json object with tree structure and want to set to the tree store as a root node with children, and avoid loading of the each child on expand. Here is the code:



store.setRootNode({
expanded : true,
leaf : false,
children : [{
title : 'folder1',
expanded : true,
children : [{
title : 'subfolder',
leaf : false,
expanded : true,
children : [...]
}]
}
...
]
});


And this doesn't work as expected. It shows all nodes as expanded but without children, and only the last node in the root is shown as expanded and with children, however if i click on the '-' icon on any node and the expand it again it shows the children as expected. My questions are:
Should this work at all? I am using the ajax proxy, because some time i need to load the store from server, can proxy be the reason? (i think proxy shouldn't be related to the problem)
Actually i don't need the nodes to be expanded, right after setting, but i need all the nodes to be set in the store, so i can get them using store.tree.flatten(). Is this achievable?
I've been tackling with this problem for couple of days now and i would really appreciate any help.

Thanks.

Gary Schlosberg
7 Apr 2014, 10:33 AM
With which version of ExtJS are you seeing this issue?

Yazla
15 Apr 2014, 1:25 AM
4.2.1