Categories | Question details Back To List | ||
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 <script> oClientDirectory=new dhtmlXTreeObject('ClientDirectory',"100%","100%",0); oClientDirectory.loadXMLString('<?xml version="1.0" encoding="iso-8859-1" ?><tree id="0">.........'); oClientDirectory.saveOpenStates(); oClientDirectory.loadOpenStates(); </script> 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? Answer posted by Support on Jan 10, 2008 10:28 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" ?><tree id="0">.........'); 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 ) |