Extjs Ext.data.store 捕获加载数据的异常,并打印信息

来源:互联网 发布:复旦医学院考研 知乎 编辑:程序博客网 时间:2024/06/13 10:22

页面js部分的写法
Js代码 复制代码 收藏代码
  1. new Ext.data.Store({  
  2.     proxy : new Ext.data.HttpProxy({  
  3.         url : basePath + '/fundAuditAction.do'  
  4.     }),  
  5.     reader : new Ext.data.JsonReader({  
  6.         totalProperty : 'total',  
  7.         root : 'root',  
  8.         successProperty : 'succeed',  
  9.         fields : [...]  
  10.     })  
  11.     ,successProperty: 'success' // 后台传输的标识。必须  
  12.     ,listeners:{  
  13.         exception:function(dataProxy, type, action, options, response, arg) {   
  14.             var o = Ext.util.JSON.decode(response.responseText);  
  15.             if(!o.success){  
  16.                 Ext.Msg.alert('错误提示',o.message);  
  17.             }  
  18.         }  
  19.     }  
  20. });  


后端产生异常时,发送json串
Java代码 复制代码 收藏代码
  1. "{success: false, message:'"+msg+"'}"  
0 1