On the dhtmlx documentation, I see this:
The following method is responsible for specifying the way server side URL is constructed during dynamical loading calls:
<script>
tree.setXMLAutoLoadingBehaviour(mode);
</script>
The following modes variants are available here:
function - is used for calling user-defined handler that should be set as the first parameter of setXMLAutoLoading() method.
So I understand that I need to write a function to add one layer of children to the actual node (the selected node), if it has children. But what I don't understand, is how I should do this, as I have some difficulty finding the right parameters to use, to be able to find the children and add them to the tree.
I am loading a local json file, with .loadJSON("data.json");. Right now, I know I should change the behavior to function and call a function that will load the children of the clicked/expended node. I've named that function loadBranch in the code below.
myTree.setXMLAutoLoadingBehaviour("function");
myTree.setXMLAutoLoading(function (id) { loadBranch(id)});
But I am not able to write a function that will only find and add those children into my dhtmlx tree. Could any of you give me a code snippet that could be used as this function?
Thanks anyway.
PS: My "ultimate" goal is to create a default dhtmlx tree that can load a json dynamically, to compare it's performance with other trees.
Try something like this:
mytree.setXMLAutoLoadingBehaviour("function");
mytree.setXMLAutoLoading (function(id){
// here based on ID you need to load some XML
mytree.loadXML(myFunction(id));
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With