DHTMLXTree onClick for child nodes only?

Hello,

I was wondering if it is possible to enable the ‘onclick’ eventhandler only for the child nodes? I would like an event to occur if the child nodes are clicked but not the parent nodes.

Many thanks.

Cheers,

Hello
You can set a check:

dhxTree.attachEvent("onClick", function(id){ if(dhxTree.hasChildren(id) == 0){ return false; } else { alert("has children") } });

Hi,

Thank you. Actually, your code had the opposite effect—the child nodes no longer handled the event and only the parent nodes…?

Sorry, mixed :slight_smile:

dhxTree.attachEvent("onClick", function(id){ if(dhxTree.hasChildren(id) > 0){ return false; } else { alert("hasn't children") //any your custom code } });

Perfect! Thank you!

Cheers,

You are welcome!