PDA

View Full Version : Ext.Element.mask() does not return mask element



AlexKorn
22 May 2011, 9:47 AM
The documentation says that Ext.Element.mask() should return the mask element. It does not. Found in Sencha 1.1.0. Platform shouldn't matter.

One-line change is in bold:



Ext.override(Ext.Element, {
/**
* Fix mask() to make it actually return the mask element
*/
mask: function(msg, msgCls, transparent) {
var me = this,
dom = me.dom,
el = Ext.Element.data(dom, 'mask'),
mask,
size,
cls = '';

me.addCls('x-masked');
if (me.getStyle("position") == "static") {
me.addCls('x-masked-relative');
}
if (el) {
el.remove();
}
if (Ext.isString(msgCls) && !Ext.isEmpty(msgCls)) {
cls = ' ' + msgCls;
}
else {
if (msgCls) {
cls = ' x-mask-gray';
}
}

mask = me.createChild({
cls: 'x-mask' + ((transparent !== false) ? '' : ' x-mask-gray'),
html: msg ? ('<div class="' + (msgCls || 'x-mask-message') + '">' + msg + '</div>') : ''
});

size = me.getSize();

Ext.Element.data(dom, 'mask', mask);

if (dom === document.body) {
size.height = window.innerHeight;
if (me.orientationHandler) {
Ext.EventManager.unOrientationChange(me.orientationHandler, me);
}

me.orientationHandler = function() {
size = me.getSize();
size.height = window.innerHeight;
mask.setSize(size);
};

Ext.EventManager.onOrientationChange(me.orientationHandler, me);
}
mask.setSize(size);
if (Ext.is.iPad) {
Ext.repaint();
}
return mask;
}
});

interfasys
4 Jun 2011, 4:38 PM
Nice find :)

keksov
13 Nov 2011, 10:44 PM
To get the mask element after calling mask() method just run the following line of code-
var mask = Ext.get( Ext.select( '[class*="x-mask"]' ) );