PDA

View Full Version : loadMsg position



milestonebass
23 Nov 2010, 4:02 PM
Is it possible for the loadMsg to be positioned near the top of the loadMask, instead of center aligned?

How so?

Thanks.

Condor
24 Nov 2010, 1:28 AM
You would have to override Ext.Element.mask to not call maskMsg.center.

milestonebass
24 Nov 2010, 5:01 PM
Thanks for your guidance Condor, it is a good approach to solving this issue.

I'm sure this is a common problem, so here's I resolved it:

Added the override as below:

Ext.Element.prototype.mask = function(msg, msgCls) {
var me = this,
dom = me.dom,
dh = Ext.DomHelper,
el,
mask,
XMASKEDRELATIVE = 'x-masked-relative',
XMASKED = 'x-masked',
EXTELMASKMSG = "ext-el-mask-msg",
data = Ext.Element.data;

if (!/^body/i.test(dom.tagName) && me.getStyle('position') == 'static') {
me.addClass(XMASKEDRELATIVE);
}
if (el = data(dom, 'maskMsg')) {
el.remove();
}
if (el = data(dom, 'mask')) {
el.remove();
}

mask = dh.append(dom, {cls : "ext-el-mask"}, true);
data(dom, 'mask', mask);

me.addClass(XMASKED);
mask.setDisplayed(true);

if (typeof msg == 'string') {
var mm = dh.append(dom, {cls : EXTELMASKMSG, cn:{tag:'div'}}, true);
data(dom, 'maskMsg', mm);
mm.dom.className = msgCls ? EXTELMASKMSG + " " + msgCls : EXTELMASKMSG;
mm.dom.firstChild.innerHTML = msg;
mm.setDisplayed(true);
//stop call to center so we can manually position
//mm.center(me);
}


if (Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && me.getStyle('height') == 'auto') {
mask.setSize(undefined, me.getHeight());
}

return mask;
};Manually positioned the mask message by modifying the following style class:

.ext-el-mask-msg