ExtJS-网格面板未加载嵌套的JSON [英] ExtJS - Grid panel not loaded with nested JSON

查看:106
本文介绍了ExtJS-网格面板未加载嵌套的JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Hello my JSON is: (formatted for better reading)

{"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()上打印它,但未将其加载到我的商店中:

This json data is loaded successfully and I can print it on the console.log() but it is not loaded to my store:

    ...
   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

怎么了?谢谢!

推荐答案

所以我用以下方法修复了它:

So I fix it with:

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()代替DeftJs inject: {}

and using Ext.create() instead of DeftJs inject: {}

感谢您的帮助.

这篇关于ExtJS-网格面板未加载嵌套的JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆