您的位置:首页 > Web前端 > JavaScript

EXTJS的JsonStore中取数据和idProperty属性重复

2011-05-11 10:35 211 查看
最近使用Ext.data.JsonStore从后台取数据时,返回的数据多条数据,但是在现实时一直是一条数据,经过排除发现是因为返回数据中有个数据对象里面有个对象的名称也为id和JsonReader的idProperty默认的id属性重复。

js代码如下:

var pieStore = new Ext.data.Store({
url : jspath+'Chaart/pie2/getGropGhgByOrgId.do' ,
baseParams :{year_a:2011,month_a:4,orgid:"40288da02edcc901012edcd1f0da0008"},
autoLoad: true ,
reader :new Ext.data.JsonReader({
root: "test",idProperty: 'idabc'},[
{name: 'season',mapping:"id.gapType"},
{name: 'total', mapping: 'total'} 2011大智慧下载
])
});

其中name的mapping对应的是id.gapType,{name: 'season',mapping:"id.gapType"},

返回的数据为:

{
"month_a":4,
"orgid":"40288da02edcc901012edcd1f0da0008",
"test":[
{
"id":{"gapType":"CH4","month":2},
"season":"CH4",
"total":"31080.00000"
},{
"id":{"gapType":"CO2","month":3},
"season":"CO2",
"total":"2081.20000"女装品牌排行榜
},{
"id":{"gapType":"HFCs","month":4},
"season":"HFCs",
"total":"10335780.00000"
}
],
"year_a":2011
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: