PDA

View Full Version : Prevent context menu on Ext.Resizable handles



7 Sep 2010, 2:42 AM
Hi

In a subclass of Ext.Panel I have the following code which allows the Panel to be resized while snapping to a grid layout. Many of these controls can be placed on the grid, each of which have a context menu.

The problem is if I right click the area of the control where a resize bar is, the default browser context menu is shown. Does anyone know if there is a way to prevent this or forward the event to the panel?

I have tried listening for click events, overriding the render and after render functions & creating a plugin but have not had any success.


var snap = new Ext.Resizable(this.el, {
handles : 'All',
widthIncrement : 10,
heightIncrement : 10,
minWidth : 20,
minHeight : 20,
dynamic : true,
transparent : true,
panel : this,
constrainTo : this.ownerCt.id,
resizeElement : function() {

var box = this.proxy.getBox();
this.panel.updateBox(box);
if (this.panel.layout) {
this.panel.doLayout();
}

return box;
}
});

Thanks in advance

tianzhou0374
23 Apr 2012, 8:22 PM
var rs=new Ext.Resizeable(el);
var ps = Ext.Resizable.positions;
for (var k in ps) {
if (typeof ps[k] != 'function' && rs[ps[k]]) {
rs[ps[k]].el.swallowEvent("contextmenu", true);
}
}