// shared reader
var reader = new Ext.data.JsonReader({},[{//ArrayReader
name : 'sensorsName'//名字(和地点一样)
}, {
name : 'typeName'//类型
}, {
name : 'siteName'//地点
}, {
name : 'data'//值
}]);
var store2 = new Ext.data.GroupingStore({// GroupingStore JsonStore
proxy:new Ext.data.HttpProxy({url : '../map.do?method=getAllInMapSensors1'}),
autoLoad : true,
reader : reader,
sortInfo : {
field : 'sensorsName',
direction : "ASC"
},// 排序的列
groupField : 'typeName'// 分组的列
});
注意GroupingStore是分组的store,这里一定要用JsonReader才能正确从后台取出数据显示出来。不能用ArrayReader
本文介绍如何使用ExtJS中的GroupingStore组件结合JsonReader来实现数据的分组及加载。通过配置GroupingStore的参数,如代理设置、自动加载、读取器以及排序和分组字段等,实现从前端到后端的数据交互。
1407

被折叠的 条评论
为什么被折叠?



