Javascript Tree Grid Extension. Collapse/Expand

Expand all

Close selected item

Open selected item

Collapse selected branch

Expand selected branch

 

<div id="treeboxbox_tree" style="width:200;height:200"></div> <script> treeGrid=new dhtmlXTreeGridObject("treeboxbox_tree","100%","100%",0); treeGrid.tree.setImagePath("../imgs/"); treeGrid.loadXML("tree.xml"); .... //expand all treeGrid.tree.openAllItems(0); //open item treeGrid.tree.openItem(id); //close item treeGrid.tree.closeItem(id); //open branch treeGrid.tree.openAllItems(id); //close branch treeGrid.tree.closeAllItems(id); </script> Parameters passed to the constructor are:
  • object to attach tree to (should be loaded before calling constructor)
  • width of the tree
  • height of the tree
  • identifier of level parent to tree root level

  • Specify Additional parameters of the treegrid:
  • setImagePath(url) - method specifies the path to the folder with tree icons
  • loadXML("tree.xml") - load tree items from XML