Multiple dhtmlx Tree's in a Single page

Hi there,



Let’s suppose i need two Tree’s in a Single Page , now how to identify which Tree was clicked at runtime so that i can act accordingly , i want some functionalities for one tree and some other for the other tree.



How to get the name of the Tree which was CLICKED so that we can condition it .



randy.

There are two approaches:

you can assign different event handlers

tree1.attachEvent(“onSelect”,handler1);
tree2.attachEvent(“onSelect”,handler2);

or you can attach single event handler and base decision on “this” value

tree1.attachEvent(“onSelect”,handler0);

tree2.attachEvent(“onSelect”,handler0);
function handler0(){
    if (this==tree1){
          //code for tree1
    } else {
          //code for tree2 here
    }
}



>>How to get the name of the Tree which was CLICKED so that we can condition it .

The tree has not such entity as name , but you can access container ID as
    this.parentObject.id;