PDA

View Full Version : Removing a load mask (Complete the api doc example for us)



stewardsencha
1 Apr 2012, 4:39 PM
The docs give a quick example (yippee!)



// Basic mask:
var myMask = new Ext.LoadMask (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.LoadMask)(Ext.getBody (http://docs.sencha.com/ext-js/4-0/#!/api/Ext-method-getBody)(), {msg:"Please wait..."});
myMask.show();


but now I have to figure out how to unmask. Hide? Destroy the component?
Argh I haven't destroyed an object yet.

Can someone with more experience please rattle off the line that is the other half of this example?
Thx

skirtle
1 Apr 2012, 5:16 PM
That example is a little out of date, though it will work.

To put a loadmask on an element (such as the body element) use:


Ext.getBody().mask('Please Wait...');
...
Ext.getBody().unmask();

To mask a component use:


var myMask = new Ext.LoadMask(cmp, {msg:"Please wait..."});
myMask.show();
...
myMask.hide();

At some point you'll need to destroy the loadmask or it will leak. For that use:


myMask.destroy();

I suppose you could use destroy instead of hide if you don't intend to use it again.

vietits
1 Apr 2012, 5:16 PM
To hide the mask but keep it for other uses, just call myMask.hide(). To destroy mask, call myMask.destroy().