Thursday, December 24, 2009

Disabling browser context menu in ExtJS

Many a times when ExtJs context menu (Right Click Menu) is added to components, it creates a problem as browser right click menu comes up after ExtJs right click menu is displayed. This is one of common issues posted on ExtJs forums consistently. Here is a simple way to solve the problem:

Add the following line:


Ext.getBody().on("contextmenu", Ext.emptyFn, null, {preventDefault: true});


as first line on ExtJs onReady function.