Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by karthikeyan on Jan 10, 2008 04:09
open dhtmlx forum
Tree to be opened with all nodes closed

Hi

I want the all the nodes in the tree to be closed when the tree is loaded from the xml.

I have been using the below code.

<script>
    tree=new dhtmlXTreeObject("col1","100%","100%",0);
    tree.setImagePath("<?=$GO_THEME->theme_url?>images/treeview/csh_bluebooks/");
    tree.loadXML("tree3.xml");
    tree.closeAllItems(0);                            
</script>

But I still the nodes are open when the tree is loaded.

Please advice.Thanks in advance.

Answer posted by Support on Jan 10, 2008 07:52
Actually if you have not "open" statements inside XML tree must load in closed state by default.

In you code instruction not executed correctly because loadXML is async command, so you can't just call command after it, you need to wait when data will be really loaded, it can be written as

    tree.loadXML("tree3.xml",function(){
        tree.closeAllItems(0);      
    });