PDA

View Full Version : TreeStore loading root node properties



david kanarek
18 Jan 2012, 12:42 PM
I'm using a Direct proxy to load my TreeStore. The problem is, while I return a complete tree, including the root with all of its properties, the TreeStore merely takes the children of the returned root and adds them to the TreeStore's existing root. Any other properties of the root node that were returned are lost.

I've found two ways to fix this:
1) Load an instance of the model used by the store, and create the store (using the loaded model instance as root) on the load's callback.

2) Load the model instance in the store's constructor, with a callback to setRootNode on the store and then invoke the real callback.

These both seem like very roundabout ways of doing what should be the natural function of the TreeStore's load.

Am I doing something wrong, or is this really the best way to load a full tree?

mitchellsimoens
19 Jan 2012, 9:35 AM
You have fields in your model to handle the properties you send back?

david kanarek
19 Jan 2012, 12:03 PM
Yeah.

In looking at the code, it seems that TreeStore's onProxyLoad is responsible for filling in the data when it is returned. That in turn calls fillNode which only adds children to the given node. This makes sense because operation.getRecords() returns only the children of the top level return object. The root's properties are not available by the time we get to onProxyLoad.

yAdEs
20 Jun 2012, 7:51 PM
Yes, I have the same problem. I send all data needed to proxy, but the treestore still load from server everytime when node expand.
The treestore read data from proxy everytime, it looks fine for other proxy, but it's terribly for directproxy. Hope it can be fixed in the near future.