0

你好,我的 JSON 是:(格式化以便更好地阅读)

{"status":{"status":0,"msg":"Ok","protocolversion":"extjs.json"},
"list":[{"getLogfiles":[
{"key":"0","value":"...lugin\/monitor\/files\/x_worker_error.log"},
{"key":"1","value":"...les\/x-worker01-progress.log.1331769600"},
{"key":"2","value":"...\/application\/x\/plugin\/monitor\/files\/Test.log"},
{"key":"3","value":"...ind\/plugin\/monitor\/files\/logfile_for_navi_test.log"},
{"key":"4","value":"...lugin\/monitor\/files\/logfilefilter_worker_error.log"}]
}]
}

此 json 数据已成功加载,我可以在 console.log() 上打印它,但它没有加载到我的商店:

    ...
   Ext.define( 'Xxx.plugins.monitor.store.GridLogfiles', {
      extend  : 'Ext.data.Store',
      mixins: [ 
         'Deft.mixin.Injectable'
      ],

      model: 'Xxx.plugins.monitor.model.GridLogfiles',

      proxy   : {
         type       : 'ajax',
         url        : 'xxx',
         extraParams: {
            user      : 'test',
            pass      : 'test',
            vers      : 'extjs.json',
            module    : 'monitor',
            func      : 'getLogfiles'
         },
         reader     : {
            type: 'json',
            root: 'list[0].getLogfiles',
            // root: 'list',
            successProperty:false
         } 
      }
     , autoLoad: true


   } );
...

我都试过root: 'list'root: 'list[0].getLogfiles

console.log()数据下找到rawData (obj) -> list (array) -> 0 -> getLogfiles (array) -> 0, 1, 2 -> key, value

怎么了?谢谢!

4

1 回答 1

0

所以我修复它:

root: 'list'

并将 Json 更改为:

{"status":{"status":0,"msg":"Ok","protocolversion":"extjs.json"},"list":[{"key":"0","value":"...lugin\/monitor\/files\/logfilefilter_worker_error.log"},{"key":"1","value":"...les\/logfilefilter-worker01-progress.log.1331769600"},{"key":"2","value":"...\/application\/x\/plugin\/monitor\/files\/Test.log"},{"key":"3","value":"...ind\/plugin\/monitor\/files\/logfile_for_navi_test.log"},{"key":"4","value":"...lugin\/monitor\/files\/logfilefilter_worker_error.log"},{"key":"5","value":"...les\/logfilefilter-worker01-progress.log.1331769600"},{"key":"6","value":"...\/application\/x\/plugin\/monitor\/files\/Test.log"},{"key":"7","value":"...lugin\/monitor\/files\/logfilefilter_worker_error.log"},{"key":"8","value":"...les\/logfilefilter-worker01-progress.log.1331769600"},{"key":"9","value":"...\/application\/x\/plugin\/monitor\/files\/Test.log"}]}

并使用Ext.create()而不是 DeftJsinject: {}

谢谢您的帮助。

于 2012-05-30T15:01:05.123 回答