PDA

View Full Version : Data.JsonStore exception do not fires



IlyasFacihov
17 Jan 2013, 2:45 AM
Hello evrebady.

I`m send server data from Ext.data.JsonStore

Code -


Acr.Store = Ext.extend(Ext.data.JsonStore,{
constructor:function(config){
var params = {action:DEFAULT_GRID_ACTION_PARAM,start:0,limit:recordPerPage};
if(config.baseParams){
params = Ext.applyIf(config.baseParams,params);
}

if(!Ext.isDefined(config.listeners))config.listeners = {};
config.listeners.exception = function(obj, type, action, options, response, arg){
var par = '';
console.log(type);
if(Ext.isDefined(obj.baseParams))for(var it in obj.baseParams){
par += it + ' : ' + obj.baseParams[it]+'<br/>';
}
Ext.Msg.alert(MSG_ERROR_TITLE,'??????? ????????? ?????? ? ??????? <br/>' + obj.url + '</br>' + (par != ''? 'c ???????????<br/>'+par : '') + '??????????? ????????!<br/>' + (Ext.isDefined(response.errortext) ? '?????? ????????<br/>' + response.errortext : ''));
};
Ext.apply(config,{
autoDestroy: true,
baseParams:params,
root:DEFAULT_ROWS_PARAM,
idProperty:config.idProperty||DEFAULT_ID_PARAM,
remoteSort:true,
autoLoad:config.autoLoad||false,
totalProperty:DEFAULT_TOTAL_COUNT_PARAM,
proxy:new Ext.data.ScriptTagProxy({url:config.url}),
lastParams: {}
});
Acr.Store.superclass.constructor.apply(this, arguments);
this.addListener('beforeload', function(s, o) { s.lastParams = o });
}});

If server return response code 302 this exception do not fires

Thanks

mitchellsimoens
18 Jan 2013, 2:02 PM
Try putting it on the proxy