ExtJs中gridpanel分组后组名排序
2024-10-19 06:20:40
/**
* 定义降序的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"
})
最新文章
- python基础04 运算
- Java-使用二叉树实现快速排序-遁地龙卷风
- SQLite(快速上手版)笔记
- Android——模拟文件拷贝
- OpenCV 图像处理学习笔记(一)
- 修改radio、checkbox、select默认样式的方法
- 缓存 Cache
- c++异常机制实现原理
- 使用Dreamwaver cc中的SVN功能,用于传输BAE和SAE中的文件
- 利用btrace工具监控在线运行java程序
- bootstrap使用汇总
- x264源代码简单分析:滤波(Filter)部分
- SpringBoot+Maven多模块项目(创建、依赖、打包可执行jar包部署测试)完整流程
- blfs(systemv版本)学习笔记-配置远程访问和管理lfs系统
- HDU3031 To Be Or Not To Be 左偏树 可并堆
- asp.net web 服务器端全局定时执行任务
- VS中 Winform查看窗体内控件之间的相互关系
- canvas基础之变换
- Linux-2.6驱动程序分层分离概念
- Python 爬虫知识点 - 淘宝商品检索结果抓包分析
热门文章
- Java关于md5加密
- SQL中 Left Join 与 Right Join 与 Inner Join 与 Full Join的区别
- Android Studio 常见问题之Rendering Problems
- 从头开始一步一步实现EF6+Autofac+MVC5+Bootstarp极简前后台ajax表格展示及分页(二)前端修改、添加表格行点击弹出模态框
- echo(),print(),print_r(),var_dump的区别?
- Dundas控件的X轴字体竖排版
- Microsoft JScript提示‘DIRECT’未定义(2014-08-26记)
- android消息处理机制之2handler与looper,MessageQueue:的关系
- top free综合监控工具
- 模板引擎:ArtTemplate 使用入门和简单的使用