复代码代码如下:
/**
* 사용자 정의 groupingStore
*/
var DescGroupingStore = Ext.extend(Ext.data.GroupingStore, {
그룹 디렉터리: 'ASC',
groupBy : 함수(필드, forceRegroup, 방향) {
방향 = 방향? (문자열(방향)
.toUpperCase() == '설명' ? '설명': 'ASC')
: this.groupDir;
if(this.groupField == 필드
this.groupDir == 방향 && !forceRegroup) {
반품;
}
this.groupField = 필드;
this.groupDir = 방향;
if (this.remoteGroup) {
if (!this.baseParams) {
this.baseParams = {};
}
this.baseParams['groupBy'] = 필드;
this.baseParams['groupDir'] = 방향;
}
if (this.groupOnSort) {
this.sort(필드, 방향);
반품;
}
if (this.remoteGroup) {
this.reload();
} 또 다른 {
var si = this.sortInfo || {};
if (si.필드 != 필드 || si.direction != 방향) {
this.applySort();
} 또 다른 {
this.sortData(필드, 방향);
}
this.fireEvent('datachanged', this);
}
},
applySort : 함수() {
Ext.data.GroupingStore.superclass.applySort.call(this);
if (!this.groupOnSort && !this.remoteGroup) {
if (this.groupField != this.sortInfo.field
|| this.groupDir != this.sortInfo.direction) {
this.sortData(this.groupField, this.groupDir);
}
}
},
applyGrouping : function(alwaysFireChange) {
if (this.groupField !== false) {
this.groupBy(this.groupField, true, this.groupDir);
사실을 반환;
} 또 다른 {
if (alwaysFireChange === true) {
this.fireEvent('datachanged', this);
}
거짓을 반환;
}
}
});
复代码代码如下:
/**************************** 사용************************* ****/
// 消息列表数据源
var messageStore = 새로운 DescGroupingStore({
프록시 : 새로운 Ext.data.HttpProxy({
url : "listMessGrid.action"
}),
리더 : myReader,
그룹 디렉터리: 'DESC',
그룹 필드: '상태',
정렬정보 : {
필드 : 'id',
방향 : "DESC"
}
});
messageStore.load();
复代码代码如下:
/********************현재 그리드 패널중추 ***********/
보기 : 새로운 Ext.grid.GroupingView({
쇼그룹이름 : false,
groupTextTpl : '{gvalue}:{text} ({[values.rs.length]} {[values.rs.length > 1 ? "封" : "封"]})',
showGroupsText: "ddd"
})