Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by karthik on Aug 03, 2009 08:20
open dhtmlx forum
Tree cloning

I am currently working on the dtmlx tree, I am having some specific requirement.

I have a tree in one div (say div1), how can I clone that tree component to another div (say div2). So that any operation in div2 should reflect in div1 and vice versa.
Answer posted by Alex (support) on Aug 04, 2009 01:25

Hello,

there are some events in tree. Please, take a look at the event list http://dhtmlx.com/docs/products/dhtmlxTree/doc/events.html#api_ev

You can set event handlers and call the corresponding method for the second tree (see the API list in the documentation http://dhtmlx.com/docs/products/dhtmlxTree/doc/alpha.html#api_a).

For example:

tree1.attachEvent("onSelect",doOnSelect)
tree2.attachEvent("onSelect",doOnSelect)
function doOnSelect(id){
 if(this==tree1) tree2.selectItem(id);
 else tree1.selectItem(id);
}