fires when the user clicks on treeview items with the right mouse button
id | string|number | the item's id |
x | number | x coordinate |
y | number | y coordinate |
ev | object | window event object |
// init treeview
var myTreeView = new dhtmlXTreeView("parentId");
// enable context menu
myTreeView.enableContextMenu(true);
// init dhtmlx menu
var myContextMenu = new dhtmlXMenuObject({
context: true // render it as context menu
});
myTreeView.attachEvent("onContextMenu", function(id, x, y, ev){
// show context menu here
myContextMenu.showContextMenu(x, y);
// optionally, you can select treeview item
myTreeView.selectItem(id);
// prevent default context menu
return false;
});
Back to top