PDA

View Full Version : Speed up displaying Modal Windows (Dialogs)



Nagiy
26 Jun 2009, 1:19 PM
I have modified Ext.Window (Ext 2.2.1) to speed up displaying Modal Windows.
I simply commented out adding/removing class "x-body-masked".
This will not work on IE 6 though. I hope you will still find it helpful.


/*
A fix to speed up showing/hiding modal dialogs (Ext 2.2.1)
*/

Ext.override(Ext.Window, {

beforeShow : function(){
delete this.el.lastXY;
delete this.el.lastLT;
if(this.x === undefined || this.y === undefined){
var xy = this.el.getAlignToXY(this.container, 'c-c');
var pos = this.el.translatePoints(xy[0], xy[1]);
this.x = this.x === undefined? pos.left : this.x;
this.y = this.y === undefined? pos.top : this.y;
}
this.el.setLeftTop(this.x, this.y);

if(this.expandOnShow){
this.expand(false);
}

if(this.modal){
//Ext.getBody().addClass("x-body-masked");
this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
this.mask.show();
}
},

afterHide : function(){
this.proxy.hide();
if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
Ext.EventManager.removeResizeListener(this.onWindowResize, this);
}
if(this.modal){
this.mask.hide();
//Ext.getBody().removeClass("x-body-masked");
}
if(this.keyMap){
this.keyMap.disable();
}
this.fireEvent("hide", this);
}

});