When somebody hits page refresh my tree is not showing the last selected value, how can I do this? I read that I can use something like tree.saveOpenStates() & tree.loadOpenStates(). But I don’t know how to use these two mehods.
Here is the example that I am using:
dhtmlx.com/docs/products/dht … okies.html
And here is my code:
var tree = new dhtmlXTreeObject(“left-nav”, “100%”, “100%”, 0)
tree.setSkin(‘dhx_vista’)
tree.setImagePath("$images_folder/csh_vista/")
tree.enableSmartXMLParsing(true);
tree.setOnClickHandler(tonclick);
tree.saveOpenStates();
tree.loadXML("/att-gs-mobility-theme/tree4.xml", function() {
tree.loadOpenStates()
});
Try to change it as
tree.loadXML("/att-gs-mobility-theme/tree4.xml", function() {
tree.loadOpenStates()
tree.attachEvent("onOpenEnd", function(){ tree.saveOpenStates(); })
});
With it, each time when you are opening branch, the new state will be saved to the cookies.
This is only available for the Professional version. The free version does not support this functionality.