dandv
January 22, 2015, 2:03am
1
This example shows that the Tree component makes an XHR request when it’s initialized, even before the user clicks the expand button:
webix.ui({
view: 'tree',
url: "data/data_dyn.php",
data: [
// parent node below
{ id: "1", value: "Branch", webix_kids: true }
]
});
Is that request necessary? The client already has all the top-level parent nodes.
Same for TreeTable .
maksim
January 22, 2015, 8:32am
2
The presence of url parameter mandates tree to load the data.
When you have the url parameter - component will load data from it without relation to any other states or configurations.
If you want to define first level of data statically and use dyn. loading for later requests, you can use onDataRequest event with ajax call.
Also, it possible to trick the component by setting url directly on internal datastore. In such case immediate data loading will not be triggered.
http://webix.com/snippet/40df15b7
dandv
January 22, 2015, 10:23am
3
Interesting example, thank you.
How come that in the ready
event handler, this
points to the Tree, but this.data points to a DataStore object, instead of to the inline data passed to the tree? Is that because the constructor parsed the inline data
array into a DataStore (TreeStore?) object?
I’ve tried to document that - please see Dynamic data loading updates by dandv · Pull Request #12 · webix-hub/docs · GitHub
maksim
January 22, 2015, 4:24pm
4
Yes, the component creates DataStore and parses data.
So this.data is an instance of datastore.