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
}
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
}
相关文章推荐
- extjs4关于proxy中设置idProperty,后store增加数据不能sync()的问题
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- ExtJs根据数据源Json数据来动态创建store与columnModel
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- Extjs 如何获取jsonstore中的数据
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- extjs JSONStore的load事件/insert,add方法应用 如何动态改变显示数据
- Extjs4 在store中获取root之外的json数据
- Extjs jsonreader 读到数据, 但是store.getCount()==0
- Extjs jsonreader 读到数据, 但是store.getCount()==0
- extjs4关于proxy中设置idProperty,后store增加数据不能sync()的问题
- extjs JSONStore的load事件/insert,add方法应用 如何动态改变显示数据
- extjs 2.3 修复 jsonstore 嵌套多级引用数据NULL的BUG
- 用C#实现多叉树的生成并转化为extjs(基于js脚本的ajax UI框架)的TreeNode的json数据格式(格式为Id,Pid,Text)
- Extjs中的store数据进行json序列化
- extjs JsonStore加载数据,Combobox只显示最后一项值问题
- ExtJS中表格控件的使用,属性设置和数据的获取(copyfrom:http://www.itzhai.com/extjs-form-controls-in-the-use-of-property-)
- extJS4.2.0 Json数据解析,嵌套及非嵌套(二)