# Collapse/Expand

| Expand all Collapse all Close selected item Open selected item Collapse selected branch Expand selected branch

    <div id="treeboxbox_tree" style="width:200;height:200"></div>
    <script>
    			tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
    			tree.setImagePath("../imgs/");
    			tree.loadXML("tree.xml");

    			....
    			//expand all
    			tree.openAllItems(0);
    			//open item
    			tree.openItem(id);
    			//close item
    			tree.closeItem(id);
    			//open branch
    			tree.openAllItems(id);
    			//close branch
    			tree.closeAllItems(id);
    </script>