Access tree object by JSON, or JSArray


I’m getting a problem when serializing the tree to JSON. It just gave me zero object.

This is my snippet:

    tree=new dhtmlXTreeObject(“treeboxbox_tree”,“100%”,“100%”,0);









    tree.loadXML(“fileCategories.xml”);//load root level from xml


    myDataProcessor = new dataProcessor(“fileCategoriesCrudOutput.xml”);


I tried to put alert(tree.getAllFatItems()); at the end but it gave me null response. And I tried to output the tree.serializeTreeToJSON()

and it just gave me {id:‘0’, item:[]} output

I would like to be able to do an interation of all items on the tree so that I can change the text, html, etc…

Any help would be appreciated


Problem can’t be reconstructed locally, please check attached sample, it loads data from XML, but serialize it back to JSON and all works correctly.

>>I tried to put alert(tree.getAllFatItems()); at the end
If you placing command directly after loadXML it will not work. Data loading is async, so you need to catch the moment when data ready. It can be done by using onXLE event or second parameter of loadXML