PDA

View Full Version : TreePanel to use different store at each level?



lxu
11 Jan 2013, 8:51 AM
Is there a way to build a tree so that level1 nodes use Store1, level2 child nodes use Store2, and so on?

The reason I want to do that is because in my tree the data at each level are different and need to be fetched using different proxies/urls and tie to different models.

mitchellsimoens
13 Jan 2013, 9:16 AM
You can use a TreeStore and when you expand a node that doesn't have any children defined it will then try to load the nodes for that node sending the id of the node that was expanded.

lxu
13 Jan 2013, 8:27 PM
You can use a TreeStore and when you expand a node that doesn't have any children defined it will then try to load the nodes for that node sending the id of the node that was expanded.

I understand that it will call the backend using the url defined in proxy, such as /service/abc?node=id. However, what if I want the node expansion to call /service/xyz/id?

lxu
13 Jan 2013, 8:44 PM
Also since my 2nd service url /services/xyz/id would return a different json (at least the root will be different for my reader), how do I specify the reader in my TreeStore? Is it possible to update the reader at run time?