EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: zolotoy on July 28, 2015, 06:12:28 AM



Title: Treegrid Dynamic load
Post by: zolotoy on July 28, 2015, 06:12:28 AM
I am looking into the following example:
http://www.jeasyui.com/tutorial/tree/treegrid3_demo.html

and cannot understand how does it know to go a get children when a node is expanded?

Thanks


Title: Re: Treegrid Dynamic load
Post by: yamilbracho on July 28, 2015, 08:12:08 AM
When you click in a node, an ajax call is made and your server side code receives the node id.
In the php code you can see a sql select where parentId is the received id.
You have to build your table with thsi structure:

id, int
parentId, int     
...

ParentId = 0 for nodes whose parent is the root of the tree.

HTH,
Yamil


Title: Re: Treegrid Dynamic load
Post by: zolotoy on July 28, 2015, 08:17:20 AM
I think it's much more than that. It will go to the server if you have loader specified:
loader:function(param,success,error){
.....
}
Or url property.

If you populate data by other means it wont happen. Can't say it is extremely intuitive.