Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Shawn on Sep 08, 2008 21:06
open dhtmlx forum
setXMLAutoLoading and loadOpenStates trying to get cookie working

I have gotten a bit further on this, but now it only opens one folder and not all of the folders I had open. Here is my code:

tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
tree.setXMLAutoLoading("/core/xmlTree.php");

tree.loadXML("/core/xmlTree.php?id=1",function(){
tree.loadOpenStates("sd");
});
tree.attachEvent("onOpenEnd",function(){
tree.saveOpenStates("sd");
});

tree.setImagePath("/core/dhx/tree/codebase/imgs/csh_vista/");

Please provide with working code if possible.
Answer posted by Support on Sep 09, 2008 04:03
The problem is that loadOpenStates generate onOpenEnd events, and after first opened folder, saveOpenStates command will reset list of items and as result opening process will stop. 

With latest version of dhtmlxtree, the next code is possible. 

tree.attachEvent("onAllOpenDynamic",function(){ 
     tree.attachEvent("onOpenEnd",function(){ 
          tree.saveOpenStates("sd"); 
     });
});
tree.loadXML("/core/xmlTree.php?id=1",function(){ 
       tree.loadOpenStates("sd"); 
}); 

If you are using older version of dhtmlxtree, which doesn't support onAllOpenDynamic event - please contact us directly at support@dhtmlx.com - we will provide updated codebase. 
Answer posted by Support on Sep 09, 2008 04:12
Working sample sent by email.
Answer posted by Shawn on Sep 09, 2008 04:20
I have not gotten the email with the working example.  Please advise.
Answer posted by Support on Sep 09, 2008 06:04
If you still have not receive a sample, please contact us directly at support@dhtmlx.com