How to disable browser context menu on Ext.menu.Menu's items?
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.
精彩评论