Hello,
I hope you can help me, i digged in the forum and the tutorial, but i didn't found a good example how I deal with a empty Json-Store.
I my case I would like to react on a failure a the server, also the JSON brings his metadata for the store from the server. I set the successProperty. But at the moment I have to deal with the success by my own. How I read it is possible that the JSON-Store will react on this. Maybe I have some problems in the configuration or in understanding how it work.
here the JSON-Stream
Code:
{
"success": false,
"errors": {
"errornumber": 403,
"errormessage": "Zugriff nicht erlaubt"
},
"metaData": {
"totalProperty": "resultcount",
"root": "Activities",
"successProperty": "success",
"message": "errors",
"fields": [
{"name": "Activity.id"},
{"name": "Activity.user_id"}, .. some more fields ..
]
},
"resultcount": 0,
"Activities": [
]
}
here the Class with deals with the JSON-Data
Code:
ActivityList =function(config){
this.StoreActivityList = new Ext.data.JsonStore({
autoLoad : true,
url : webRoot+'dashboard/activitylist.json',
listeners:{loadexception:function(a,request,response,error){
if(error instanceof Error) {
var msg = "Error while processing server response: "+error.name+": "+error.message;
Ext.Msg.alert('Fehler',msg);
}else{
alert(response);
}
},
load: function(store, records, options){
var data = store.reader.jsonData;
if(!data.success){
alert(data.errors.errormessage);
}
}
}
});
var preConfig = {
store: this.StoreActivityList ,
viewConfig: {
forceFit: false
},
sm: new Ext.grid.RowSelectionModel({singleSelect:false}),
frame:true,
title:'aktuelle Alarme',
iconCls:'icon-grid',
region:'center',
};
//config um fehlende Werte erweitern
if (config != null){
Ext.applyIf(config,preConfig);
}else{
config = preConfig;
}
ActivityList.superclass.constructor.call(this, config);
};
Ext.extend(ActivityList, Ext.grid.GridPanel, {
info: function(){
//
}
});
My Question is: Why does the Store not react on success:false and how can I stop the processing in load-event?
Thanks