-
13 Jun 2012 5:39 AM #1
how to load all nodes and childrens in a unique request
how to load all nodes and childrens in a unique request
I need to load a treepanel but i want to load it completely in only one request, in a few words, load this remote data and the tree works like with local data.
-
13 Jun 2012 5:58 AM #2
Not sure about "works like with local data", but if you load the store it will remain until you reload it (or synch)...
Or are you talking about the fact that a request is sent as soon you expand a node?
When I load my treepanel I do
Code:Ext.getCmp('tp').getStore().load(root:Ext.GetCmp('tp').root);
-
13 Jun 2012 6:08 AM #3
Yes, i am talking about the request when expand a node.
I don't want to this happen, i want the nodes are preloaded.
-
13 Jun 2012 6:13 AM #4
-
13 Jun 2012 6:31 AM #5
Use the "children" property in the json data to preload child nodes. The tree guide explains this in more detail.
Phil Guerrant
Ext JS - Development Team
-
13 Jun 2012 6:44 AM #6
i do, but the data is loading remotely and the nodes do a request when are expanded...
i tried loading all data using the property "childrens" and the nodes still doing the request.
-
13 Jun 2012 6:55 AM #7
Do you have the expanded property on all you nodes?
Code:"expanded": true
-
13 Jun 2012 7:00 AM #8
yes, i used that property and is a solution but if i want the tree start collapsed and preloaded.. how can i do?
-
13 Jun 2012 7:01 AM #9
Try setting the "loaded" property to true for nodes that you do not want to dynamically load. Here is a quote from the tree guide I linked to in my earlier post:
"For all non-leaf nodes that do not have children, the server response MUST set the loaded property to true. Otherwise the proxy will attempt to load children for these nodes when they are expanded."Phil Guerrant
Ext JS - Development Team
-
13 Jun 2012 7:09 AM #10
Question: this property will avoid the proxy to load the children but are they loaded?
Extract for the guide:
butCode:{"success":true,"children":[{"id":1,"name":"Phil","leaf":true},{"id":2,"name":"Nico","expanded":true,"children":[{"id":3,"name":"Mitchell","leaf":true}]},{"id":4,"name":"Sue","loaded":true}]}
Will the node 5 loaded?Code:{"success":true,"children":[{"id":1,"name":"Phil","leaf":true},{"id":2,"name":"Nico","expanded":true,"children":[{"id":3,"name":"Mitchell","leaf":true}]},{"id":4,"name":"Sue","loaded":true,"children":[ { "id": 5, "name": "SueMitchell", "leaf": true } } ]}


Reply With Quote