我在将数据从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"}
]}请帮帮我!
发布于 2011-10-20 11:11:15
使用4.0.2a中测试的Ext.data.Store代替JsonStore
我在文档里也找不到JsonStore
试试这个:
var store = new Ext.data.Store({
fields:['mainid','Country'],
proxy: {
type: 'ajax',
url : '/projectLink/gridData.php',
reader: {
type: 'json',
root: 'rates',
totalProperty : "count"
}
},
autoLoad : true
});发布于 2011-10-20 19:51:40
我不确定这是否是问题所在,但是配置autoLoad是错误的。
你有:autoLoad=true
应该是:autoLoad : true
https://stackoverflow.com/questions/7826205
复制相似问题