复制代码代码如下:
/**
* 定义降序的groupingStore
*/
var DescGroupingStore = Ext.extend(Ext.data.GroupingStore, {
Gruppenverzeichnis: 'ASC',
groupBy : function(field, forceRegroup, Direction) {
Richtung = Richtung ? (String(Richtung)
.toUpperCase() == 'DESC' ? 'DESC' : 'ASC')
: this.groupDir;
if (this.groupField == field
this.groupDir == Richtung && !forceRegroup) {
zurückkehren;
}
this.groupField = Feld;
this.groupDir = Richtung;
if (this.remoteGroup) {
if (!this.baseParams) {
this.baseParams = {};
}
this.baseParams['groupBy'] = field;
this.baseParams['groupDir'] = Richtung;
}
if (this.groupOnSort) {
this.sort(Feld, Richtung);
zurückkehren;
}
if (this.remoteGroup) {
this.reload();
} anders {
var si = this.sortInfo || {};
if (si.field != Feld || si.direction != Richtung) {
this.applySort();
} anders {
this.sortData(Feld, Richtung);
}
this.fireEvent('datachanged', this);
}
},
applySort : function() {
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);
return true;
} anders {
if (alwaysFireChange === true) {
this.fireEvent('datachanged', this);
}
return false;
}
}
});
复制代码代码如下:
/*************************调用*********************** ****/
// 消息列表数据源
var messageStore = new DescGroupingStore({
Proxy: new Ext.data.HttpProxy({
URL: „listMessGrid.action“
}),
Leser: myReader,
Gruppenverzeichnis: 'DESC',
groupField: 'status',
sortInfo: {
Feld: 'id',
Richtung: „DESC“
}
});
messageStore.load();
复制代码代码如下:
/********************在gridpanel中添加如下属性****************************** ***********/
Ansicht: new Ext.grid.GroupingView({
showGroupName: false,
groupTextTpl : '{gvalue}:{text} ({[values.rs.length]} {[values.rs.length > 1 ? "封" : "封"]})',
showGroupsText: „ddd“
})