а

Dynamic Loading from local JSON


#1

If we use Dynamic Loading, each node when expanded will load the data from the server using the url configured by setXMLAutoLoading method.

I have the complete dataset locally at client-side in a JSON object. Is there any way to create a dynamic tree, but instead of making calls to the server to load the data, can we load the data from the local JSON object ?

I just want to avoid making multiple round-trips to the server. But the tree data is large, that I cannot serialize all of it to JSON in one call.

Any ideas?


#2

Try to use dhtmlxDataStore extension docs.dhtmlx.com/doku.php?id=dhtmlxdatastore:toc


#3

If you have PRO edition, you may define function as the handler for dynamic loading. So, the function will be called instead of Ajax request. In this case, you need to define the function that will process branch loading and put it into the setXMLAutoLoading method. The function takes parent id as a parameter:

tree.setXMLAutoLoadingBehaviour(“function”);
tree.setXMLAutoLoading(function(id){
tree.loadJSONObject(…);
});


#4

Hi Alexandra & Olga,

Many thanks for your input. Alexandra your solution was right on the mark and exactly what I needed…

You are a life saver!

Once again, Thanks!


#5

Anybody has a generic function to get the child nodes to appear? I’m new to dhtmlx and I’m having some problems with the content of that function. I’m simply loading a local json file.