Using dynamical loading and save/open states

Hello. Using professional version of dhtmlxtree.



I have a tree that I am using Dynamical loading with, and I use event onOpenEnd to saveOpenStates (this works, as I can see the cookie(s) and nodes as they are expanded).



Is it possible to to loadOpenStates on page refresh and open dynamical nodes ?



Thank you for all help.



J.

loadOpenStates command is compatible with dyn. loading modes ( it will open existing items, wait till child items loaded and continue opening and loading if necessary )
You need not any extra steps, just use loadOpenStates same as in normal case.

Hi Stanislav,

Thanks for the quick reply.

Based on your answer, I’m obvioulsy doing something wrong… Here is the code I use to instantiate the tree:

tree01=new dhtmlXTreeObject(“idTree01”,“100%”,“100%”,0);
tree01.setImagePath("/includes/dhtmlxTree/codebase/imgs/csh_vista/");
tree01.enableMultiLineItems(true);
tree01.setDragBehavior(“complex”);
tree01.attachEvent(“onDrag”,fnDoOnDrag);
tree01.attachEvent(“onOpenEnd”,tree01.saveOpenStates);
tree01.enableDragAndDrop(true,false);
tree01.setXMLAutoLoadingBehaviour(“id”);
tree01.loadXML("/ajax/ajaxReportEngine.php?mode=ListAvailableTree", function() {
    tree01.loadOpenStates()
});
tree01.setXMLAutoLoading("/ajax/ajaxReportEngine.php?mode=ListAvailDyn");

Is there anything else I should be doing to get this to work? I am not getting errors, but it is simply not working.

Any and all help is appreciated.

Best regards.

J.

a) instead of
tree01.attachEvent(“onOpenEnd”,tree01.saveOpenStates);
you need to have


b) to have this correct for multilevel opening, the code need to be changed as
tree01.loadXML("/ajax/ajaxReportEngine.php?mode=ListAvailableTree", function() {
tree01.attachEvent(“onAllOpenDynamic”,function(){
//code here will be executed only when loadOpenStates will load all data from server
tree01.attachEvent(“onOpenEnd”,function(){
tree01.saveOpenStates()
});
});
tree01.loadOpenStates()
});