Categories | Question details Back To List | ||||||||
setContextMenuHandler overriding existing Menu's handler I have dhtmlxMenu and a dhtmlXContextmenu on the same page. I am setting the handler for the context menu using the code shown below cMenu.setContextMenuHandler(onButtonClick); function onButtonClick(menuitemId,grid_Id){ alert("Context mnu clicked"); } This works fine except that it also overrides the handler of the dhtmlxMenu on the page. So if I click on any menu item this handler gets called. Please advise. Answer posted by Support on Oct 23, 2008 06:23 The setContextMenuHandler will affect only the single menu instance ,it will not affect any other menu objects on the page. The function set by setContextMenuHandler will override any code attached to the same menu object, by setOnClickHandler handler. They can't be used togather with the same menu object. Answer posted by Prashanth on Oct 23, 2008 07:06 That does not seem to be the behavior that is displayed. Here is more detailed code. This is the first menu
var menuNamea90d86c8762142389e9df1fa54efaa88 = null; function doInitGrida90d86c8762142389e9df1fa54efaa88(){ menuNamea90d86c8762142389e9df1fa54efaa88 = new dhtmlXContextMenuObject('120',0,"");menuNamea90d86c8762142389e9df1fa54efaa88.menu.setGfxPath("scripts/dhtmlxmenu/imgs/"); menuNamea90d86c8762142389e9df1fa54efaa88.setOnShowMenuHandler(onShowMenua90d86c8762142389e9df1fa54efaa88); menuNamea90d86c8762142389e9df1fa54efaa88.menu.loadXML("ControlServlet?elementid=a90d86c8762142389e9df1fa54efaa88_f4c80a611f5449568f8d30caee1bebd9&contextmenu=menudata&uid=1224770187548"); menuNamea90d86c8762142389e9df1fa54efaa88.setContextMenuHandler(onButtonClicka90d86c8762142389e9df1fa54efaa88); ....}function onButtonClicka90d86c8762142389e9df1fa54efaa88(menuitemId,grid_Id){alert("First menu clicked");}dojo.addOnLoad(doInitGrida90d86c8762142389e9df1fa54efaa88);// Loads the first menu.// Second menu Answer posted by Support on Oct 23, 2008 08:04 Problem can't be reconstructed Please check attached sample Attachments (1)
|