<ul id="subMenu"> <li class="e-list" role="menuitem"><a>OrderID</a></li> <li class="e-list" role="menuitem"><a>CustomerID</a></li> <li class="e-list" role="menuitem"><a>EmployeeID</a></li> <li class="e-list" role="menuitem"><a>ShipCountry</a></li> </ul>
$("#Grid").ejGrid({ dataSource: window.dataSource, allowPaging: true, contextMenuSettings: { enableContextMenu: true, customContextMenuItems: ["Refresh", "SubMenus"] }, contextClick: "conClick", //helps to assign functionality to the custom menu dataBound: "dataBound", columns: [ { field: "OrderID", headerText: "Order ID", width: 90 }, ] });
}); function conClick(args) { if (args.text == "Refresh") this.refreshContent(true); } function dataBound(args) { $("#Grid_Context").find(".e-customitem:eq(1)").append($("#subMenu")) |
$("#Grid").ejGrid({ dataSource: window.dataSource, allowPaging: true, contextMenuSettings: { enableContextMenu: true, contextMenuItems: [], customContextMenuItems: ["<img src='/Content/undo.jpg' style='width:20px;height:20px' />Refresh"] }, contextClick: "conClick", dataBound: "dataBound", columns: [ { field: "OrderID", headerText: "Order ID", width: 90 }, ] });
}); function conClick(args) { if (args.text == "Refresh") this.refreshContent(true); |
$("#Grid").ejGrid({ dataSource: window.dataSource, allowPaging: true, contextMenuSettings: { enableContextMenu: true }, contextOpen: "Open", columns: [ { field: "OrderID", headerText: "Order ID"}, . . . . ] });
}); function Open(args) { var data = args.model.currentViewData[$(args.target).closest("tr").index()]; |
<div id="Grid"></div> <ul id="subMenu"> <li class="e-list" role="menuitem"><a>OrderID</a></li> </ul> <script type="text/javascript"> $(function () {
$("#Grid").ejGrid({ dataSource: window.dataSource, allowPaging: true, contextMenuSettings: { enableContextMenu: true }, contextOpen: "Open", columns: [ { field: "OrderID", headerText: "Order ID", textAlign: ej.TextAlign.Right, width: 90 }, . . . . ] });
}); function Open(args) { $("#Grid_Context").append($("#subMenu li")) //Here Grid is id of the Grid Element <div id="Grid"></div> |