Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by aalekhya on Mar 02, 2009 02:54
open dhtmlx forum
ISSue with tree

Hi
Iam using dhtmltree and grid in my code.
I used 2 dropdowns.while selecting those dropdown tree and grid are displayed.
If i change value of dropdown new tree and grid are came.
For that i am using the following code.
if(tree != null && typeof(tree) != "undefined"){

tree.deleteChildItems(0);
}
if(mygrid != null && typeof(mygrid) != "undefined"){
//destructor, removes grid and cleans used memory

mygrid.destructor();
mygrid = null;

}

In jsp i used 2 divs for displaying tree and grid.the code is given below

<div id="treebox_tree" style="width:400px; height:350px;background-color:#FFFFFF;border :1px solid Silver; overflow:auto;" class="dhtmlTree"></div><br>

<script type="text/javascript" language="JavaScript">

// tree node constructor
var tree=new dhtmlXTreeObject("treebox_tree","100%","100%",0);
if(tree != null && typeof(tree) != "undefined"){
//set path to images directory
tree.setImagePath("images/treeImgs/");
//enable/disable smart XML parsing mode (usefull for big, well structured XML)
tree.enableSmartXMLParsing(true);
// tree.enableDistributedParsing(true);
//enable item highlighting (item text highlited on mouseover)
tree.enableHighlighting(true);
}
</script>
<DIV id="gridbox" style="width:525px; height:382px;background-color:white;border :1px solid Silver;overflow:hidden"></DIV>


I want to use tree.destructor() function in my code same as grid.distructor().
If i used it intially it is loading correctly.
But after changing the value in drop down
the tree is populated in the bottom of the "treebox_tree" div.grid is diplaying correctly.
why it is happening?
Please provide me solution how can i use destructor() function for tree?

Please send me soltion asap.

thanks
aalekhya
Answer posted by Alex (support) on Mar 02, 2009 06:34

Hello,

The issue with tree destructor was fixed in the latest  tree version. You can try to use following approach to fix it in tree 1.6:

tree.destructor();

tree.parentObject.innerHTML=""; /*or the same - document.getElementById("treebox_tree").innerHTML="";*/