手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >ExtJs中gridpanel分组后组名排序实例代码
ExtJs中gridpanel分组后组名排序实例代码
摘要:复制代码代码如下:/***定义降序的groupingStore*/varDescGroupingStore=Ext.extend(Ext.d...

ExtJs中gridpanel分组后组名排序实例代码1

复制代码 代码如下:

/**

* 定义降序的groupingStore

*/

var DescGroupingStore = Ext.extend(Ext.data.GroupingStore, {

groupDir : 'ASC',

groupBy : function(field, forceRegroup, direction) {

direction = direction ? (String(direction)

.toUpperCase() == 'DESC' ? 'DESC' : 'ASC')

: this.groupDir;

if (this.groupField == field

this.groupDir == direction && !forceRegroup) {

return;

}

this.groupField = field;

this.groupDir = direction;

if (this.remoteGroup) {

if (!this.baseParams) {

this.baseParams = {};

}

this.baseParams['groupBy'] = field;

this.baseParams['groupDir'] = direction;

}

if (this.groupOnSort) {

this.sort(field, direction);

return;

}

if (this.remoteGroup) {

this.reload();

} else {

var si = this.sortInfo || {};

if (si.field != field || si.direction != direction) {

this.applySort();

} else {

this.sortData(field, direction);

}

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;

} else {

if (alwaysFireChange === true) {

this.fireEvent('datachanged', this);

}

return false;

}

}

});

复制代码 代码如下:

/*************************调用***************************/

// 消息列表数据源

var messageStore = new DescGroupingStore({

proxy : new Ext.data.HttpProxy({

url : "listMessGrid.action"

}),

reader : myReader,

groupDir : 'DESC',

groupField : 'status',

sortInfo : {

field : 'id',

direction : "DESC"

}

});

messageStore.load();

复制代码 代码如下:

/*****************在gridpanel中添加如下属性*************************************/

view : new Ext.grid.GroupingView({

showGroupName : false,

groupTextTpl : '{gvalue}:{text} ({[values.rs.length]} {[values.rs.length > 1 ? "封" : "封"]})',

showGroupsText : "ddd"

})

【ExtJs中gridpanel分组后组名排序实例代码】相关文章:

Javascript进制转换实例

javascript中DOM复选框选择用法实例

Ctrl + Enter提交前检测的代码

JS函数实现鼠标指向图片后显示大图代码

JavaScript生成福利彩票双色球号码

用于table内容排序

微信WeixinJSBridge API使用实例

jQuery实现div随意拖动的实例代码(通用代码)

光标定位等TextRange的操作的范例代码

JavaScript数组去重的3种方法和代码实例

精品推荐
分类导航