Categories | Question details Back To List | ||
dhtmlxTree best way of tree building 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("<tree id='ROOT'><item id='1' text='Node1'><item id='2' text='Node2'></item></item></tree>"); 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 Answer posted by Support on May 23, 2008 02:39 Basically the both approaces are correct, but second one a bit faster. >>In my first sample, all items are opened tree.openOnItemAdded(false); >>I use insertNewItem method |