PDA

View Full Version : GridPanel and error handling



pibree
12 Oct 2010, 6:32 AM
Hi
I have a gridpanel with a data store that loads data to remote server:

Now when there is an error on store loading the mask remains visible on the grid panel
I would ask how,if there is an error , I can removes the mask and in the gridpanel keep data of the last success loading.
My code is :



this.store.load(
{params:{start:this.start,limit:this.limit},
scope:this,
callback: function(records, options, success) {
if (success) {
} else {
//Remove the mask
//Keep the last data
}
}
});

Many Thanks
Marco

plalx
12 Oct 2010, 6:57 AM
The mask should automatically be removed even in case of a loading error... are you manually masking the grid or you are using loadMask: true on the grid?

pibree
12 Oct 2010, 7:11 AM
I use loadMask:true

psmacarov
12 Oct 2010, 7:38 AM
I use this

var myMask = new Ext.LoadMask(Ext.getBody(), {msg: "???? ???? ? ???????? ??????, ?????????? ?????????..."});
Ext.Ajax.on('beforerequest', myMask.show, myMask);
Ext.Ajax.on('requestcomplete', myMask.hide, myMask);
Ext.Ajax.on('requestexception', myMask.hide, myMask);

All work fine

plalx
12 Oct 2010, 10:09 AM
@psmacarov, I only dislike the fact that it's blocking the entire UI on each ajax requests...

@pibree, when you say when there is an error... do you mean that there is a javascript uncaught error, or that the exception event fires on the store? If there is an uncaught javascript error, any javascript code might stop executing, causing the mask to stay visible...

pibree
13 Oct 2010, 6:40 AM
I mean an error that like web server down , Internet access is falling down etc...