Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Madhuri on May 28, 2008 11:58
open dhtmlx forum
dhtmlxTree - How to persist the tree state

Hi,
What is the best way to persist the tree state when I reload the page.
I am initializing the tree from HTML List as , so I'd like to do it from HTML.

<div id="treeboxbox_tree" setImagePath="http://mc.emagineering.com/admin/Menu_Includes/dhtmlxTree/codebase/imgs/csh_bluebooks/" class="dhtmlxTree" style="width:155px; height:370px; ">

Thank you for your help...
Answer posted by Support on May 29, 2008 04:08
dhtmlxtree_xw.js extension allows to use
    tree.saveOpenStates(name)
    tree.loadOpenStates(name)
to store and restore tree state.
Basically they not purposed to be used in case of loading from HTML, but you can enable necessary functionality by adding next code on the page.

    dhtmlxEvent(window, "unload", function(){
        treeboxbox_tree.saveOpenStates('any')
    });
    dhtmlxEvent(window, "load", function(){
       window.setTimeout(function(){
            treeboxbox_tree.loadOpenStates('any')
        },100);
    });