View Full Version : Weird behavior load() method of TreeStore

14 Feb 2012, 6:30 AM

I have a problem when calling load() method of Ext.data.TreeStore (I use Ext JS 4.0.7)
The problem seems to depend on the JSON response object.

In this case, no additional ajax requests are fired:

{text: 'ROOT', expanded: true, children: []}
However in this case, two additional ajax requests are fired:

{text: 'ROOT', expanded: true, children: [{'id':'N01','text':'1','leaf':true},{'id':'N02','text':'2','leaf':true}]}
I tried that with more responses and it comes out that the number of additional ajax calls depends on the number of JSON objects contained in the response, which is a big problem when trees are more complex :s

Any solution or workaround?

14 Feb 2012, 8:43 AM
When you do your load() call, do you pass in the node?

node : someNode

14 Feb 2012, 2:54 PM
I have a TreeStore with proxy of type ajax. Then I do a call with additional params to change the tree based on id:

myStore.load({params: {id: 'DS00001'}});

but I do not pass a node - I expect that the tree is refreshed from the server JSON response. After the initial load correctly one request is sent, but after invoking load() method I have multiple requests being sent to the server as described above.. What did you mean by passing a node? Node object, or some text identification of what will be the root node from the response?

1 Jun 2012, 11:31 AM
Hi, I had the same problem, when trying to reload the whole tree based on another param. Indeed the bigger the tree, the more requests were sent (some were aborted, leading to invalid json etc etc)

My solution was to do :

before executing the .load method of the store