Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is different between asynctreenode and treenode?

What is different between asynctreenode and treenode in Extjs? When should I one or another? Thanks.

like image 838
phuang07 Avatar asked Aug 19 '10 20:08

phuang07


1 Answers

The easiest way is to look at it like this:

A treenode is a flat piece of predefined, constant information. When the parent tree is loaded, the underlying node structure is (hypothetically) fixed at that point. It is easier to look at it from the context that when you expand a node, its children are effectively 'known' (predetermined/hardcoded) before they are loaded.

An async node, 'asynchronously' loads its imediate children when queried. These children can be dynamically set at any stage of the operation, and can change based on any number of factors and served up as appropriate. Each expansion of a child is dynamic.

Therefore, when taken as an absolute, a regular node will always have the same children (not always true, but true in the context of this explanation), an async node may have different children at different times. Async nodes could, for example, dynamically load children from a database (which may contain different records at different times), or based on another factor within the application. So, if you want to set the treepanel structure, go for a regular node- if you think the treepanel structure may change based on a number of factors, use an async node to load the children from a query.

Hope it helps!

like image 171
SW4 Avatar answered Nov 12 '22 20:11

SW4