开发者

How to disable browser context menu on Ext.menu.Menu's items?

开发者 https://www.devze.com 2022-12-21 07:58 出处:网络
Assume I have a menu (Ext.menu.Menu) with som开发者_C百科e items. When menu is shown user cat right-click on it\'s item and browser context menu will be shown (with elements like \"Save link as...\").

Assume I have a menu (Ext.menu.Menu) with som开发者_C百科e items. When menu is shown user cat right-click on it's item and browser context menu will be shown (with elements like "Save link as...").

How can I disable that browser context menu? Globally in all Ext.menuMenu instances if possible.


possibly solved

Works for single menu instance:

contextMenu.on('render', function (menu) {
    menu.getEl().on('contextmenu', Ext.emptyFn, null, {preventDefault: true});
});


For all instances you could do it this way:

Ext.override(Ext.menu.Menu, {
    render : function(){
        Ext.menu.Menu.superclass.render.call(this);
        this.el.on("contextmenu", Ext.emptyFn, this, {preventDefault: true});
    }
});

You may also want to do something similar for toolbars if needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消