DHTMLX Tree Object

Hi,

I have initialized a tree object like this :
var tree = new dhtmlXTreeObject(‘treeBox’, ‘100%’, ‘100%’, 0);

and have loaded proper data in the tree. Now, i want to disable click and doubleclick on the items itself. The node should expand only when you click one of the image icons next to node. To make the image icon click work, i have added following code:
var eventId = tree.attachEvent(‘onClick’, function (id: number) {
var state = tree.getOpenState(id);
if (state == -1) {
tree.openAllItems(id);
} else {
tree.closeAllItems(id);
}
});

However, my onclick handler gets executed when i click the node and when i click the icon. How to disable it on node click and doubleclick? Any simple method that i can call to disable

Thanks in advance!

Hi, there is no way to distinguish click on text part and click on image part of the item.
You can try to use a native HTML event, like in the next snippet

snippet.dhtmlx.com/5486e79f8

Thanks! It would be easy if dhtmlXTreeObject’s onRowSelect method passed the event object to “onClick” handler like this: that.callEvent(“onClick”, [e, obj.id, lastId]);

Is that on the roadmap?