Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Leo on Apr 07, 2009 13:29
open dhtmlx forum
tree.setOnClickHandler

Hi,

I’m trying out the DHTMLX Tree and have following one of the examples given. This is my tree definition:

<script>
    tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
    tree.setImagePath("dhx-tree/codebase/imgs/csh_bluebooks/");
    tree.setOnClickHandler(onNodeSelect);
    //tree.enableDragAndDrop(true);    
    tree.openAllItems();                             tree.loadXML("GetReportsTreeDataStr.action")    
                            
    function onNodeSelect(nodeId)
    {
    alert("Say something!") ;
    }
</script>

No matter what I do, when I click on a node or an item, the tree always responds with the node or item value.

I’ve changes the tree and function around several times but the response is always the same. How can I get the tree to go to onNodeSelect() when I click on something?

Thanks,
Answer posted by Alex (support) on Apr 08, 2009 05:05

Hello, 

setOnClickHandler sets onclick event handler only for tree items. 

For what purpose do you want to use this method ? 

Answer posted by Leo on Apr 08, 2009 05:42

Hi Alex,

Actually, I got the tree working ok. The problem was that I was using JSP which wasn’t being refreshed. After the server got the new version of the JSP the tree works as intended.

Thanks for the help.