two separate context menus on one page: one for a tree, anot

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 was sent by email.