Check documentation for the latest version of dhtmlxSuite attachContextMenu DHTMLX Docs

attachContextMenu

attaches a context menu to a window icon

dhtmlXMenuObject attachContextMenu(object config);
configobjectthe configuration object of the context menu
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);
 
// attaches a global context menu to windows' icons
var myMenu = dhxWins.attachContextMenu({
    icons_path: "menu/icons/",
    xml: "menu/menu.xml"
});
 
// ==> at the moment both windows have myMenu attached to icon
 
// attaches an individual context menu to the icon of 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 the icon of window "w2" has a personal "myMenu2" attached

Back to top