Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Marco C. on Aug 06, 2008 01:30
open dhtmlx forum
DHTMLX Tree - restoreSelectedItem() doesn't work!!! (it works only on second level of the tree)

This is my code:

tree=new dhtmlXTreeObject('treepanel',"100%","100%",0);
tree.setImagePath("/be3a5/GUI/content/imgs/tree/");
tree.setOnClickHandler(openFolder);
....
tree.setXMLAutoLoading("/be3a5/GUI/content/xml/dyntree.xml?country="+parent.actualCountry);

tree.loadXML("/be3a5/GUI/content/xml/dyntree.xml?id=0&country=" + parent.actualCountry,function(){
tree.loadOpenStates("CNT" + parent.actualCountry,cb);
});
tree.restoreSelectedItem("CNT" + parent.actualCountry);
tree.attachEvent("onOpenEnd",function(){
tree.saveOpenStates("CNT" + parent.actualCountry);


The function restore selectedItem dosn't work because when is activate, the loadOpenStates function is again expanding the tree...
Is it possible to add a callback?

Thanks,

Marco
Answer posted by Support on Aug 06, 2008 03:31
Updated version of dhtmlxtree_xw.js sent by email, it introduce new event "onAllOpenDynamic" which will fire after all necessary items loaded and expanded , so you can use 

tree.attachEvent("onAllOpenDynamic", function(){ //will be called after loadOpenStates finished
            tree.restoreSelectedItem("CNT" + parent.actualCountry); 
});
tree.loadOpenStates("CNT" + parent.actualCountry,cb);




Answer posted by Marco C. on Aug 06, 2008 05:34
There wasn't an attachment with the new js file updated.
Answer posted by Support on Aug 06, 2008 05:59
The email was sent to the address which was used for post creating. 
If you still has not receive it - please contact us directly at support@dhtmlx.com