gpt4 book ai didi

ajax - ExtJS-网格为空但存储已加载

转载 作者:行者123 更新时间:2023-12-01 16:15:00 26 4
gpt4 key购买 nike

尽管商店中填充了json数据,但我的网格未填充。怎么了?
我希望将"csv":[...]中的所有数据写入网格列。
如果我对商店进行console.log()编码,则我的json数据位于store.proxy.reader.[jsonData|rawData].data.csv => Array [4]

杰森数据:

{"status":{"status":0,"msg":"Ok","protocolversion":"1.1.json"},"data":{"headline":{"headline":"headline"},"csv":[{"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"}]}}

模型:
Ext.define( 'Monitor.model.ComboLogfiles', {
extend: 'Ext.data.Model',
fields: [ {name: 'key'}, {name: 'value'} ]
} );

商店:
Ext.define( 'Monitor.store.ComboLogfiles', {
extend : 'Ext.data.Store',
model : 'Monitor.model.ComboLogfiles',
proxy : {
type : 'ajax',
url : '/devel/phi/dev/04-presentation/http-api/index.php',
extraParams: {
user : 'test',
pass : 'test',
vers : '1.1.json',
module : 'monitor',
func : 'getLogfiles'
},
reader : {
type: 'json',
root: 'csv'
// root: 'data'
}

},
autoLoad: true
} );

控制者
var store = Ext.create('Monitor.store.ComboLogfiles');

oLogfileSelector = Ext.create("Ext.window.Window", {
title: 'Logfiles',
width: '200',
height: '400',
autoScroll: true,
flex: 1,
minimizable: false,
maximizable: false,
style: 'background-color: #fff;',
items: [{
xtype: 'panel',
items: [
Ext.create('Ext.grid.Panel', {
id: 'mygrid',
store: store,
width: 200,
height: 200,
title: 'Logfiles',
columns: [
{
text: 'Key',
width: 50,
sortable: false,
dataIndex: 'key'
}
,{
text: 'File',
width: 100,
sortable: false,
dataIndex: 'value'
}
]
})
]

}]

}).show();

最佳答案

也许这样尝试:

reader: {
type: 'json',
root: 'data.csv',
successProperty:false
}

关于ajax - ExtJS-网格为空但存储已加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10547496/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com