Hi.
I’m trying to load different context menus for different rows in grid.
When i understand right clearAll() should help unloading the previous menu and loading a new menu. For me clearAll() prevents the context menu from being rendered.
Here my code so far:
// Switch the contextual menu before rendering
[code]grid.onBeforeContextMenu = function(iD) {
grid.clearAll(); // prevents contextual menu from rendering
if('register'===grid.getUserData(iD,"type"))
grid.context.loadXML("@home/context_register.xml");
else if('account'===grid.getUserData(iD,"type"))
grid.context.loadXML("@home/context_account.xml");
return true;
}; grid.attachEvent("onBeforeContextMenu", grid.onBeforeContextMenu);[/code]
// Create the basic contextual menu
grid.context = new dhtmlXMenuObject();
grid.context.setIconsPath("../common/images/");
grid.context.renderAsContextMenu();
grid.enableContextMenu(context);