Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tapani Jalonen on Dec 05, 2008 01:37
open dhtmlx forum
two separate context menus on one page: one for a tree, another for a grid

I am attempting to initialize two separate context menus for the same page, like this:

menu = new dhtmlXMenuObject(null,"standard");
menu.setImagePath("dhtmlxMenu/codebase/imgs/");
menu.setIconsPath("imgs/");
menu.renderAsContextMenu();
menu.setOpenMode("win");
mytree.enableContextMenu(gridContextMenu);

gridContextMenu = new dhtmlXMenuObject(null, "standard");
gridContextMenu.setImagePath("dhtmlxMenu/codebase/imgs/");
gridContextMenu.setIconsPath("imgs/");
gridContextMenu.renderAsContextMenu();
gridContextMenu.setOpenMode("win");

mygrid.enableContextMenu(gridContextMenu);

The first init works perfectly when done alone, but two inits on the same page does not seem to directly work, but fails on line 119 of dhtmlxmenu.js:

if (this.base._autoSkinUpdate) {
this.base.className = this.base.className.replace("dhtmlxMenu_"+oldSkin+"_Middle","")+"dhtmlxMenu_"+this.skin+"_Middle";
}

The error firebug returns is "this.base has no properties".

What are steps required to achieve two separate context menus for two different dhtmlx components?

Answer posted by Support on Dec 08, 2008 02:12
Answer was sent by email.