【发布时间】:2011-12-11 04:34:13
【问题描述】:
我在将数据从 JSON 存储加载到 EXT 网格时遇到问题。以下是代码:
var store = new Ext.data.JsonStore({
root: 'rates',
autoLoad=true,
fields: ['mainid','Country'],
proxy : new Ext.data.HttpProxy({
method: 'GET',
url: '/projectLink/gridData.php'
})
});
var grid = Ext.create('Ext.grid.Panel',{
renderTo: 'grid-rates',
width:700,
height:500,
title:"Country",
store:store,
columns:[
{id: 'mainid', header: "mainid", width: 200, sortable: true, dataIndex: 'mainid'},
{id: 'Country', header: "Country", width: 200, sortable: true, dataIndex: 'Country'}
]
});
JSON 存储在向服务器发送请求并发送回数据时被填满,但网格从未填充:( 缺少什么?
按照我正在使用的 JSON:
{"count":"18239",
"rates":[
{"mainid":"75966","Country":"Afghanistan Cellular-AT"},
{"mainid":"75967","Country":"Afghanistan Cellular-AWCC"},
{"mainid":"75968","Country":"Afghanistan Cellular-Areeba"},
{"mainid":"75969","Country":"Afghanistan Cellular-Etisalat"},
{"mainid":"75970","Country":"Afghanistan Cellular-Others"},
{"mainid":"75971","Country":"Afghanistan Cellular-Roshan"},
{"mainid":"75972","Country":"Albania"},
{"mainid":"75973","Country":"Albania Cellular-AMC"},
{"mainid":"75974","Country":"Albania Cellular-Eagle"},
{"mainid":"75975","Country":"Albania Cellular-Plus"}
]}
请帮忙!
【问题讨论】:
-
您遇到任何错误吗?如果有帮助,请发布错误消息。
标签: javascript json extjs grid store