/**
* 定义降序的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分组后组名排序的更多相关文章

  1. MySQL 排名、分组后组内排名、取各组的前几名 及排名后更新插入数据表中

    一.排名 /*普通排名:从1开始,顺序往下排*/ AS rank ) r ORDER BY score; /*并列排名:相同的值是相同的排名*/ SELECT cs.* , CASE WHEN @p= ...

  2. MySQL 排名、分组后组内排名、取各组的前几名

    一.排名 /*普通排名:从1开始,顺序往下排*/ AS rank ) r ORDER BY score; /*并列排名:相同的值是相同的排名*/ SELECT cs.* , CASE WHEN @p= ...

  3. 034-openstack中虚拟机启动后主机名设置问题

    openstack中虚拟机启动后主机名设置问题,在centos7中设置hostname后怎么都是原来的hostname,根本无效. 方法一: 在centos7中除了修改hosts文件和network文 ...

  4. SQL实现group by 分组后组内排序

    在一个月黑风高的夜晚,自己无聊学习的SQL的时候,练习,突发奇想的想实现一个功能查询,一张成绩表有如下字段,班级ID,英语成绩,数据成绩,语文成绩如下图 实现 查询出 每个班级英语成绩最高的前两名的记 ...

  5. sql 分组后 组内排名

    语法:ROW_NUMBER() OVER(PARTITION BY COLUMN ORDER BY COLUMN) 简单的说row_number()从1开始,为每一条分组记录返回一个数字,这里的ROW ...

  6. group by 查询分组后 组的条数

    比如select gid from table group by gid 查询时使用下面的方法查询条数 select count(distinct gid) from table 使用select c ...

  7. sql 分组后查询出排序字段

    select  row_number() over(partition by  CODE order by SEQUENCE) as RowIndex  from Table 注:根据表的CODE 字 ...

  8. Extjs中GridPanel的各个属性与方法

    1.Ext.grid.GridPanel 主要配置项: store:表格的数据集 columns:表格列模式的配置数组,可自动创建ColumnModel列模式 autoExpandColumn:自动充 ...

  9. extjs中gridpanel动态显示/隐藏列

    在extjs3中,大家知道用 myGrid.getColumnModel().setHidden(i,true);但到了4.0后,已经没有getColumnModel这个方法了,我们在Ext.pane ...

随机推荐

  1. RobotFrameWork webservice soap接口测试 (二)

    上一篇提到做soap接口测试自己简单的写了个py,然后就简单的实现了个客户端能对远程接口进行调用,对返回的数据进行解析,可后面想着也觉得不对劲,soap协议虽说不像http协议那么普及,但是现在很多公 ...

  2. Qt信号与槽应用实例一

    ..... connect(m_pGlobelWidget,signal(globeControlClick(object,object)),this,slot(globeControlClick(o ...

  3. ECMAScript 6教程 (三) Class和Module(类和模块)

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出 原文连接,博客地址为 http://www.cnblogs.com/jasonnode/ .该系列课程是 ...

  4. Android MimeType的用法和几种类型

    关于MIME TYPE描述 多用途互联网邮件扩展(MIME,Multipurpose Internet Mail Extensions)是一个互联网标准,它扩展了电子邮件标准,使其能够支持非ASCII ...

  5. window route 命令

    使用 Route 命令行工具查看并编辑计算机的 IP 路由表.Route 命令和语法如下所示: route [-f] [-p] [Command][Destination] [mask Netmask ...

  6. 动态的计算行高 加载数据源 有多少显示多少 tableView 包含 colloctionView 显示复杂的界面写法

    有时候,我们经常碰到这样的需求 先遵守代理 @interface PublishCollectionCell ()<UICollectionViewDataSource, UICollectio ...

  7. 《C#编程》课件 - C#基础

    声明多维数组• 创建一个多维数组int[,] intMatrix;float[,] floatMatrix;string[,,] strCube;使用new关键字• 必须指定每个维度的大小int[,] ...

  8. 使用cygwin出现syntax error near unexpected token'$'do\r

    直接从csdn复制粘贴的.sh代码,放到cygwin下运行sh的时候出错syntax error near unexpected token'$'do\r 解决方法: 1.下载notepad++ 2. ...

  9. iOS 枚举的巧用

    前言 在之前的一篇文章中简单的提到了这个问题, 但是自己写的不详细, 并且自己深入了解的也不是特别多, 在开发中也没怎么用到,所以经过阅读者的反馈对这个问题很是疑惑! 本篇文章会分析之前的不足之处, ...

  10. python 学习笔记十三 JQuery(进阶篇)

    jQuery 是一个 JavaScript 库. jQuery 极大地简化了 JavaScript 编程. 安装jQuery 有两个版本的 jQuery 可供下载: Production versio ...