Check documentation for the latest version of dhtmlxSuite attachContextMenu DHTMLX Docs

attachContextMenu

attaches a context menu to windows globally, if a custom menu hasn't been set for each window

dhtmlXMenuObject attachContextMenu(object config);

Parameters

configobjectthe configuration object of the context menu

Returns

dhtmlXMenuObjectthe context menu instance

Example

// init some windows
var dhxWins = new dhtmlXWindows();
var w1 = dhxWins.createWindow("w1", 1, 1, 320, 200);
var w2 = dhxWins.createWindow("w2", 1, 1, 320, 200);
 
// attach a global context menu to windows
var myMenu = dhxWins.attachContextMenu({
    icons_path: "menu/icons/",
    xml: "menu/menu.xml"
});
 
// ==> at the moment both windows have myMenu attached to icon
 
// attach a custom context menu to icon for the window #2
var myMenu2 = w2.attachContextMenu({
    icons_path: "menu/icons/",
    xml: "menu/menu2.xml"
});
 
// ==> and now window w1 has a global myMenu attached to icon
// and window w2 has a custom myMenu2

Back to top