PDA

View Full Version : Ext 2.0: show LoadMask if store is loading at construction time



tyr
8 Mar 2008, 1:10 PM
Problem:
create a store call store.load() create a GridPanel, store is still loading PROBLEM: loadMask is not visible


This Problem will be fixed with this few lines of code:
First, we need a isLoading method which returnes true if the store loads data currently

if( Ext.data.Store.prototype.isLoading === undefined ){
Ext.override(Ext.data.Store,{
isLoading : function(){
if( this.proxy
&& this.proxy.activeRequest
&& this.proxy.activeRequest.tId ){
return true
}

var conn = this.proxy.getConnection();
if( conn
&& conn.isLoading() ){
return true;
}

return false;
}
});
}

second, call show method at construction time

var _prototype = Ext.LoadMask.prototype;
Ext.LoadMask = Ext.LoadMask.createSequence( function(){
if( this.store && this.store.isLoading() ){ this.show(); }
});
Ext.LoadMask.prototype = _prototype;

Thats all.