【发布时间】:2011-11-23 16:51:03
【问题描述】:
我有一个 JSON 存储,我想将它自动加载到 grid.panel 中。不幸的是,在完成异步获取后,网格中没有填充任何内容。 Firebug 显示 JSON 检索成功。
商店:
var datasetStore = new Ext.data.JsonStore({
root: 'rows',
fields: ['griddap', 'Subset', 'tabledap', 'Make A Graph', 'wms', 'Title', 'Summary', 'Info', 'Background Info', 'RSS', 'Email', 'Institution', 'Dataset ID'],
proxy: new Ext.data.HttpProxy({
url: 'http://localhost:8080/proxy.php?u=http://coastwatch.pfeg.noaa.gov/erddap/info/index.json'
}),
autoLoad: true
});
网格:
var datasetListingGridPanel = new Ext.grid.GridPanel({
id: 'datasetListingGridPanel',
preventHeader: true,
store: datasetStore,
layout: 'fit',
viewConfig: {
forceFit:true,
fitcontainer:true
},
columns:
[
{
header: 'Dataset Title',
dataIndex: 'Title'
}
]
});
编辑 - JSON
{
"table": {
"columnNames": ["griddap", "Subset", "tabledap", "Make A Graph", "wms", "Title", "Summary", "Info", "Background Info", "RSS", "Email", "Institution", "Dataset ID"],
"columnTypes": ["String", "String", "String", "String", "String", "String", "String", "String", "String", "String", "String", "String", "String"],
"rows": [
["", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", ""]
]
}
}
因为它们很长,所以我把它们取出来了。
对出了什么问题有任何想法吗?
【问题讨论】:
标签: javascript json extjs grid extjs3