Need context menu for xml menu

I have an XML menu in which each item needs a context menu. The context menu needs one option to allow the user to right click and open the selected item in a new window. The code is as follows:

var appMenu = layout.attachMenu();
appMenu.loadStruct(‘/_apps/DISBilling/data/DISBillingMenu.xml’);
var navContextMenu = new dhtmlXMenuObject();
navContextMenu.renderAsContextMenu();
navContextMenu.addNewChild(navContextMenu.topId, 0, “window”, “Open in window”, false, “”);
appMenu.attachEvent(“onClick”, function(id, ZoneID, cas) {}

The XML menu is working properly but the context menu is not working at all. Any suggestions are appreciated.

Hi

context menu is disabled in source code, but you can try to change this:

dhtmlXMenuObject.prototype._renderSublevelPolygon = function(id, parentId) { s.oncontextmenu = function(e) {....} // remove this };
then you also need to add contextZone to new menu, or:

s.oncontextmenu = function(e) { newMenu.showContextMenu(....) }
also you can wrap all this code into menu.callEvent(“onItemContextMenu”,[]) for example, finally:

mainMenu.attachEvent("onItemContextMenu", function(x,y){ newMenu.showContextMenu(x,y); });
(this is not working code, this is just a usage demo)

Thank you for the suggestions. I will give it a try.