您好我的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
有什么问题?谢谢!
答案 0 :(得分: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()
代替DeftJs inject: {}
感谢您的帮助。