PDA

View Full Version : TreeGrid asynchronous loading of children (best practice)



jjoe64
26 Jan 2012, 12:15 AM
Hi.
What is the best way to do lazy loading of the children items in a TreeGrid?
Because I have a huge set of items, I have to load the children items from the server when the parent item expands.

Is there any way implemented in GXT or do I have to load them manually..?

Thanks.

PhiLho
26 Jan 2012, 7:29 AM
Are you looking for the Async TreeGrid?
http://www.sencha.com/examples-dev/#ExamplePlace:asynctreegrid

jjoe64
26 Jan 2012, 7:43 AM
thanks.
I already solved it in the meantime.
With google I didn't find this resource..

[closed]

ramdesolanki
11 Jun 2012, 10:43 PM
How you solved this? I am facing the same problem.

sanbenwu
9 Oct 2013, 6:35 AM
i have the same problem,are you solved ?

nebbian
19 Jan 2014, 5:20 PM
Just in case someone runs into this via google (like I did), the way to solve this is to do the following:

If your data has a children field, then it will not asynchronously load children.

If you want asynchronous loading, you need to remove the 'children' field from your data.

ie: This will asynchronously load when you click on the folder

[{
"ShopTree": {
"id": "ShopCategory1",
"name": "Campers"
},
"leaf": false
}, {
"ShopTree": {
"id": "ShopCategory5",
"name": "Accessories"
},
"leaf": false
}]

while this will not asynchronously load:

[{
"ShopTree": {
"id": "ShopCategory1",
"name": "Large Items"
},
"children": [],
"leaf": false
}, {
"ShopTree": {
"id": "ShopCategory5",
"name": "Accessories"
},
"children": [],
"leaf": false
}]