PDA

View Full Version : loadMask() fadeout or defer unmask



16 Jan 2011, 6:26 PM
I am using the shortcut form of loadmask as in:

Ext.get('theGrid').mask('Adding...', 'x-mask-loading');

My issue is that the ajax call is so quick that the user doesn't see the activity (i.e., I want display the mask for at least .25 seconds as an indicator that the action has been taken).

My call to remove the mask is:
Ext.get('theGrid').unmask();

I have tried a number of approaches without any success so far so any insights will be appreciated.

bc

evant
16 Jan 2011, 7:27 PM
Something like this:



Ext.onReady(function(){
var start = new Date();
Ext.Ajax.request({
url: 'foo',
success: function(){
var difference = new Date() - start;
if (difference < 250) {
setTimeout(function(){
doUnmask();
}, 250 - difference)
} else {
doUnmask();
}
}
});
});