Hi,
What’s the best way to build a tree ?
1.
var tree=new dhtmlXTreeObject(document.getElementById(‘treeBox’),“100%”,“100%”,“ROOT”);
tree.setImagePath(“imgs/”);
var t = tree.insertNewChild(“ROOT”,“NODE1”,“New Node 1”,0,0,0,0,"");
t = tree.insertNewChild(“NODE1”,“NODE2”,“New”’’ Node 2",0,0,0,0,"");
2.
var tree=new dhtmlXTreeObject(document.getElementById(‘treeBox’),“100%”,“100%”,“ROOT”);
tree.setImagePath(“imgs/”);
tree.loadXMLString("");
In my first sample, all items are opened. I try to add value CLOSE in the optionString parameter but it does’nt work.
tree.insertNewChild(“ROOT”,“NODE1”,“New Node 1”,0,0,0,0,“CLOSE”);
How to do ?
Can I use performance methods like enableSmartRendering when I use insertNewItem method ?
Thanks
Basically the both approaces are correct, but second one a bit faster.
>>In my first sample, all items are opened
When items added one by one, component will automatically expand branches , can be changed by
tree.openOnItemAdded(false);
tree.insertNewChild(…
>>I use insertNewItem method
No, both smartXMLParsing and smartRendering will work only in case of loading from external source