Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Sep 09, 2008 04:34
open dhtmlx forum
I have tried this code, but now it does not seem to save the OpenStates.

I also just bought the code yesterday, so hopefully I have the latest version?

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

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

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

//enable features
tree.enableDragAndDrop(1);
//tree.enableItemEditor(true);

//set handlers
tree.setDragHandler(myDragHandler);
tree.setOnClickHandler(doOnClick);
//tree.setOnEditHandler(doOnEdit);
 
function myDragHandler(idFrom,idTo)
{
      alert("DRAG");
    //if we return false then drag&drop be aborted
     return true;
}

function doOnClick(nodeId)
{
    var myUrl = tree.getUserData(nodeId,'myurl');
    iFrameSrc(unescape(myUrl), 'iLogic');
}

function doOnEdit(nodeId)
{
    alert("edit");
}

</script>
Answer posted by Support on Sep 09, 2008 05:14
>>I also just bought the code yesterday, so hopefully I have the latest version?
Yep, you must have the latest version on current moment. 

>>I also just bought the code yesterday
Please check the sample, which was sent by email, it is using one more trick to separate js treads

tree.attachEvent("onAllOpenDynamic",function(){ 
  tree.attachEvent("onOpenEnd",function(){ 
     window.setTimeout(function(){ // need to wait while open tread will be closed
         tree.saveOpenStates("sd1"); 
    },1);

  });
});