I have managed to get a context menu to appear in my timesheet project but not over the actual event: it appears at the top of the main page.
I figure this is because it’s not attached correctly to events. However, the code was lifted verbatim (except for path changes) from the “01_dhtmlxMenu.html” file in the ‘samples\10_integration’ folder. That sample works correctly Here’s what I have:[code] scheduler.load(“scheduler/data/GetTasks.php”, “json”);
var menu = new dhtmlXMenuObject();
menu.setSkin("dhx_terrace");
menu.setIconsPath("scheduler/ContextMenu/images/");
menu.renderAsContextMenu();
menu.loadStruct("scheduler/ContextMenu/dhxmenu.xml?e=" + new Date().getTime());
scheduler.attachEvent("onContextMenu", function(event_id, native_event_object) {
if (event_id) {
var posx = 0;
var posy = 0;
if (native_event_object.pageX || native_event_object.pageY) {
posx = native_event_object.pageX;
posy = native_event_object.pageY;
} else if (native_event_object.clientX || native_event_object.clientY) {
posx = native_event_object.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
posy = native_event_object.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
menu.showContextMenu(posx, posy);
return false; // Prevent default action and propagation
}
return true;
});[/code]