商店中的加载监听器

问题描述:

我在我的商店中使用加载监听器。商店中的加载监听器

https://docs.sencha.com/extjs/4.1.0/source/AbstractStore.html#Ext-data-AbstractStore-event-load

listeners: { 
    load: function (store, records, success, opts) { 

    } 
} 

如果成功=假,我希望得到一个错误信息,或者它为什么失败的HTTP响应的东西。

我在哪里可以得到这些信息?

您正在查找商店代理中的exception事件。

看看这个小提琴https://fiddle.sencha.com/#view/editor&fiddle/1l5m

Ext.define('MyApp.store.MyJsonStore', { 
    extend: 'Ext.data.Store', 

    requires: [ 
     'Ext.data.proxy.Ajax', 
     'Ext.data.reader.Json' 
    ], 

    autoLoad: true, 
    storeId: 'MyJsonStore', 
    proxy: { 
     type: 'ajax', 
     url: 'non-existing-data.json', 
     reader: { 
      type: 'json' 
     }, 
     listeners: { 
      exception: function (proxy, response, operation, eOpts) { 
       // debugger; 
      } 
     } 
    } 
});