Saving tree states

I am using loadXMLString(XMLTreeString) to load the tree ASP script generates the XMLTreeString works great.

code in the script looks like this





After viewing the tree and closing the page, then reopening the page the tree state is not being restored

what am I doing wrong? Does the saveOpenState function have to be called each time the tree state changes?

In you code saveOpenStates will rewrite previously saved state, you can use next code

oClientDirectory=new dhtmlXTreeObject(‘ClientDirectory’,“100%”,“100%”,0);

oClientDirectory.loadXMLString(’<?xml version="1.0" encoding="iso-8859-1" ?>…’);

oClientDirectory.loadOpenStates();

oClientDirectory.attachEvent(“onOpenEnd”,function(){

    oClientDirectory.saveOpenStates();


});

In such case saved state will be correctly restored on loading, and saved in cookie after any open|closing operation.
( alternatively you can attach saving command to unload event of window )