Extjs4中store加载数据失败,可通过定义Exception监听打印错误信息!
Ext.define("Manager.store.applications.bm.bhm.JobConfigStore", {
extend : 'Ext.data.Store',
model : 'Manager.model.applications.bm.bhm.JobConfigModel',
pageSize: extPageSize,
proxy : {
type : 'ajax',// 后台加载
url : extPath+'/action/bhm/json/QueryJobConfigAction',
timeout : 5000,
reader : {
type : 'json',
root : 'result'
},
writer : {
type : 'json'
},
actionMethods: {
read: 'POST'
},
listeners:{
exception:function( theproxy, response, operation, options ){
if(!Ext.isEmpty(response.responseText)) {
var responseJson = Ext.decode(response.responseText);
Ext.Msg.alert('提示框', '加载数据失败,原因为:'+responseJson.errorMsg);
}
}
}
},
listeners:{
beforeload:{
fn:function(store, options){
var params = Ext.getCmp('query_job_config_panel').form.getValues();
Ext.apply(store.proxy.extraParams, params);
}
}
}
});