Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
930
Popup menu in Firefox using WebMenu
posted

Here's another question for you guys! :)

I've created a pop-up menu for my grid using a webmenu. The pop-up menu pops up fine, but in order to not have the standard browser-pop-up menu displayed I need to do event.cancelBubble=true. It works fine in IE but as Firefox doesn't support the event object (as explained here) I can't cancel the bubble in this browser. As it is now, I just do a check on the browser type, and don't perform the event.cancelBubble=true if it's FF. Here's my code:

function showContextMenu(gridName, cellID, button) {
    if (button == 2) {
        clickedGridName = gridName;
        clickedCellID = cellID;
        if (navigator.appName == "Microsoft Internet Explorer") {
            igmenu_showMenu(MyMenuId, event);
            event.returnValue = false;
            event.cancelBubble = true;
        }
        else {
            igmenu_showMenu(MyMenuId, null);
        }
    }
}

In my code-behind I do:

this.UltraWebGrid1.DisplayLayout.ClientSideEvents.CellClickHandler = "showContextMenu";

The question is: can I make it work so Firefox doesn't display the bubble? Any ideas?

I do have another question regarding the igmenu_showMenu here which you might be able to help me solve if you can help me solve this one? Please take a look at it. Any help appreciated!

Parents
  • 20
    posted

    Hi all,

     

    Did any of you solve this problem yet? The problem, in short, is how to prevent Firefox from showing the default context menu after handling the right cell click.

     

    From what I understand, I should somehow get access to the event object in the handler function, but I don't know how to do that. I use the following code:

     

     Code-behind:

    grid.DisplayLayout.ClientSideEvents.CellClickHandler = "GridCellClick";

     

    BLOCKED SCRIPT

    function GridCellClick(gridName, cellID, button) {
        if (button == 2) {
    // Some code
        }

    }

     

    So how do I pass the event to the handler function?

     

    Thanks for replying!

Reply Children
No Data