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.







Thank you for your help…

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);
    });