dhtmlTree - attached event onNodeSelect wont work!

Hi!, im triying to use dhmtlTree for browsing documents etc etc etc …



so part of my code is:



function test (x) {

alert(“hi there!”);

}



var dhxTree = dhxLayout.cells(“a”).attachTree(“nROOT”);

dhxTree.setImagePath("/dhtmlx/dhtmlxTree/codebase/imgs/");

dhxTree.attachEvent(“onNodeSelect”,test);

dhxTree.insertNewChild(“nROOT”,“nREP”,“Repository”,"","","","","",“0”);



but nothing really happens when i click on a node, i also try to attach the event “onSelect” but the same thing.



in fact i need to define a actionHandler for eah node, so i took a peek on documentation and it shows that insertNewChild 4th paramter is exactly for that, but if a put “test” there i got this error:



obj.actionHandler is not a function, i’ve triyed putting the “test” function after / berfore the Tree… and also in another area, but is keeps the same



thanks in adavance

Instead of
dhxTree.attachEvent(“onNodeSelect”,test);
You need to use
dhxTree.attachEvent(“onClick”,test);

Full list of supported events, can be checked at
dhtmlx.com/docs/products/dhtmlxT … tml#api_ev

>>in fact i need to define a actionHandler for eah node
By using attachEvent@onClick you will assign common event handler , which will be used for all items in tree by default.