Index.cshtml
<script type="text/javascript">
function template(args) {
if (args.column.headerText === "Inupt1") {
var ele = args.cell.querySelector('.list');
var menuItems = [
{
text: 'Events',
items: [
{ text: 'Conferences' },
{ text: 'Music' },
{ text: 'Workshops' }
]
},
];
var menuComp = new ej.navigations.Menu({
items: menuItems, beforeOpen: function (args) {
//Handling sub menu items
var grid = document.getElementsByClassName('e-grid')[0].ej2_instances[0];
var row = new ej.grids.parentsUntil(args.event.target, 'e-row', false);
var rowDetails = grid.getRowInfo(new ej.grids.parentsUntil(args.event.target, 'e-row', false));
if (row && rowDetails.rowData.OrderID > 10001 && rowDetails.rowData.OrderID < 10005) {
for (var i = 0; i < args.items.length; i++) {
if (disableItems.indexOf(args.items[i].text) > -1) {
menuComp.enableItems([args.items[i].text], false, false);
}
}
}
}});
menuComp.appendTo(ele);
var disableItems = ['Music', 'Workshops'];
}
}
</script> |