ホームページ  >  記事  >  ウェブフロントエンド  >  ExtJs_javascript スキルでグリッドパネルのグループ化後にグループ名を並べ替えるコード例

ExtJs_javascript スキルでグリッドパネルのグループ化後にグループ名を並べ替えるコード例

WBOY
WBOYオリジナル
2016-05-16 17:11:111550ブラウズ

ExtJs_javascript スキルでグリッドパネルのグループ化後にグループ名を並べ替えるコード例

复制代代码如下:

/**
* groupingStore を降順で定義します
*/
var DescGroupingStore = Ext.extend(Ext.data.GroupingStore, {
groupDir : 'ASC',
groupBy : function(field,forceRegroup, Direction) {
direction = 方向 ? (String(direction) touppercase()== 'desc': 'asc')
) {
return;
}
this.groupField = フィールド;
this.groupDir = 方向;
if (this.remoteGroup) {
if (!this.baseParams)
this.baseParams = {};
}
this.baseParams['groupBy'] = フィールド;
this.baseParams['groupDir'] = 方向;もし(this.groupOnSort) {
this.sort(field, direct);
return;
if (this.remoteGroup) {

} else {
var si = this.sortInfo || {};
if (si.field != フィールド || si.direction != 方向) {
this.applySort();
} else {
this.sortData(フィールド, 方向);
}
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.group)フィールド、本当、 this.groupDir);
true を返します。
} else {
if (alwaysFireChange === true) {
this.fireEvent('datachanged', this);
}
false を返します。
}
}
});






复制代码

代码如下:

/***************************電話************************ *****/
// メッセージ リスト データ ソース
var messageStore = new DescGroupingStore({
proxy: new Ext.data.HttpProxy({
url : "listMessGrid.action"
})、
リーダー : myReader、
groupDir : 'DESC'、
groupField : 'status'、
sortInfo : {
フィールド : 'id ',
方向 : "DESC"
}
});
messageStore.load();

コードをコピー コードは次のとおりです:

/*****************次の属性をグリッドパネルに追加します**************************** ** ********/
view : new Ext.grid.GroupingView({
showGroupName : false,
groupTextTpl : '{gvalue}:{text} ({[values.rs.length]} {[values.rs.length >] ; 1 ? "クロージャ" : "クロージャ"]})',
showGroupsText : "ddd"
})

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。