How to Add Sub Menus to Context Menu in Search Grid

There is the possibility of adding sub menus to the context menu in the search grid of Aras Innovator menu items.

Aras.Client.Controls.ContextMenu control supports submenus. It provides two methods for adding menu items:

  1. add(id, label, parentMenuId, args);
  2. addRange(items, parentMenuId);

The following are the examples given for itemsGrid.html:

Example #1

var menu = grid.getMenu();

menu.add(“item_0", “Item 0");

menu.add(“item_0.0", “Item 0.0", “item_0", { onClick: function () { alert(0); } });

menu.add(“item_0.1", “Item 0.1", “item_0", { onClick: function () { alert(1); } });

menu.add(“item_0.2", “Item 0.2", “item_0", { onClick: function () { alert(2); } });

Example #2

var menu = grid.getMenu(),

subMenus = [

{

id: “item_0.0",

name: “Item 0.0",

onClick: function () { alert(0); }

},

{

id: “item_0.1",

name: “Item 0.1",

onClick: function () { alert(1); }

},

{

id: “item_0.2",

name: “Item 0.2",

onClick: function () { alert(2); }

}

];

menu.add(“item_0", “Item 0");

menu.addRange(subMenus, “item_0");