load tree dynamically on click of a button


Hi,

I am using dhtmlXtree in my application,



I have already loaded the tree using below code, after getting the tree populated,I wants to load the tree with different values dynamically when onclick of button…
In my JSP I have a button called LOADTREE, I want to load the tree onclick of this button,
So, how do I load tree dynamically on click of a button?


here is my code:















I have tried the below way to load the tree dynamically, I had called the method tree.loadXML(‘myPage.do?param1=’+param1value+‘�m2=’+param2value);



when onclick of the button, but the tree is getting appended to the old tree. So is there any way to load the tree dynamically?

I have tried the below way to load the tree dynamically, I had
called the method
tree.loadXML(‘myPage.do?param1=’+param1value+‘m2=’+param2value);
>>when onclick of the button, but the tree is getting appended to the old tree. So is there any way to load the tree dynamically?

The logic is the next - if you need to reload tree, then you need to call
    tree.deleteChildItems(0);
to delete existing tree and call
    tree.loadXML(url);
to load new dataset.
The url must contain any necessary parameters to server side script