а

Function to dynamically load a JSON at the tree's data


#1

Hi all, I have a dhtmlx tree, loading it’s data from a simple JSON file locally. I wanted to get dynamic loading (only one level of the selected branch at a time) but it seems I need to write my own function to be called when a node is expanded.

The only answers about this in this forum is in this format:

tree.setXMLAutoLoadingBehaviour("function"); tree.setXMLAutoLoading(function(id){ tree.loadJSONObject(...); });

I am new to dhtmlx and was wondering if there is a simple function I could use/paste in my code. The only examples I’ve seen use the IDs of the parent node to get the IDs of the child nodes to add them, but this only works when the structure is clear with a specific way the IDs are attributed (not my case) and I don’t like that kind of answers that only work with a specific tree. I was wondering if there is a simply function that would simply add the needed children of the selected node? Like most platform offer without us having to write the function ourselves? haha.

Sorry if this is obvious, I am not that good with this. Thanks anyway.