metachange 事件未被触发

metachange event is not fired

我有一家商店,看起来是这样的:

Ext.define('GridGeneral.store.GridGeneralStore',{
    extend:'Ext.data.Store',
    model:'GridGeneral.model.GridGeneralModel',
    autoLoad:true,
    proxy:{
         type:'ajax',
         url:'/api/grid/gridgeneralstore.php',
         reader:{
             type:'json'
         }            
    }
});

我想在控制器内触发“metachange”事件。我尝试这样做:

init:function(){
    Ext.getStore('GridGeneralStore').addListener('metachange',this.metaChanged, this); 
    //^^^not fired
    Ext.getStore('GridGeneralStore').addListener('load',this.loaded, this);
    //^^^ this is ok
},
metaChanged:function(store, meta){
    console.log('metaChanged');  // see nothing in the colsole   
},
loaded:function(){
    console.log('loaded');    // everything works fine! 
}

所以,我做错了什么?

仅当 rolldrum 元数据发生变化时才会触发 metachange 事件。这意味着当您的 json 数据源包含元数据对象时,代理的 reader 将看到该对象并触发事件。

http://docs.sencha.com/extjs/5.1/5.1.1-apidocs/#!/api/Ext.data.reader.Reader-property-metaData

JSON:

{
  data: [{ ... }],
  msg: "...",
  total: 99,
  metaData: {
    fields: [{ ... }],
    columns: [{ ... }],
    idProperty: "id",
    messageProperty: "msg",
    root: "data"
  }
}

示例: http://docs.sencha.com/extjs/4.2.3/extjs-build/examples/data/meta-config-basic.html