dhtmlxTree -- setAutoLoading (Dynamical Loading in dhtmlxTre

Hi,



I need your help with setAutoLoading feature in dhtmlxTree.



Parent.xml:



<?xml version="1.0" encoding="iso-8859-1" ?>











Child.xml:



<?xml version="1.0" encoding="iso-8859-1" ?>



    









    







JS:

function callTree(){

var tree;

    tree=new dhtmlXTreeObject(document.getElementById(‘treeBox’),“400%”,“150%”,0);;

    tree.setImagePath(“codebase/imgs/”);

    tree.enableCheckBoxes(false);

    tree.setXMLAutoLoading(“http://localhost/xml/Child.xml”);

    tree.loadXML(“http://localhost/xml/Parent.xml”);//load root level from xml

}





Issue:



While browsing the top node, it give an loadxml error. According to “Dynamical Loading in dhtmlxTree v.1.x” documentation, this should work as for each parent “id” you have a corresponding child “id” in the format.



Kindly help.



Thanks,

Mohit.


Hello,


child.xml is incorrect - there are two nodes.


You should set the path to the server-side script that will generate either:


<?xml version="1.0" encoding="iso-8859-1" ?>






for "a1"


or


<?xml version="1.0" encoding="iso-8859-1" ?>








for “app”.


Please, take a look at the article: dhtmlx.com/docs/products/dhtmlxT … ading.html


If you have PRO edition, you can set custom “autoloading” function that will load different static xml files for a specific node.


tree.setXMLAutoLoadingBehavior(“function”);
tree.setXMLAutoLoading(function(id){
/your code here/
});