extjs分组查询
<script type="text/jscript">
var grid;
Ext.onReady(function () {
Ext.QuickTips.init();
var reader = new Ext.data.Record.create([
{ name: 'DWDM', type: 'string' }
, { name: 'AZFS', type: 'string' }
, { name: 'ND', type: 'string' }
, { name: 'MXMC', type: 'string' }
, { name: 'ZX', type: 'string' }
, { name: 'ZD', type: 'string' }
, { name: 'PJZ', type: 'string' }
, { name: 'TQJG', type: 'string' }
, { name: 'TBZJL', type: 'string' }
, { name: 'SL', type: 'string' }
, { name: 'SR', type: 'string' }
]);
var views = new Ext.grid.GroupingView({
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "条" : "条"]})',
startCollapsed: true
});
//Ext.getBody().mask("数据重新加载中,请稍等");
//Ext.getBody().unmask();//去除MASK var store = cs(new Ext.data.GroupingStore({})); //首次加载的数据源
function cs(url) {
var store = new Ext.data.GroupingStore({
proxy: new Ext.data.HttpProxy({ url: url }),
sortInfo: { field: "MXMC", direction: "ASC" },
groupField: "MXMC",
reader: new Ext.data.JsonReader({
totalProperty: 'total',
root: 'rows',
successProperty: 'success',
fields: ['DWDM', 'AZFS', 'ND', 'MXMC', 'ZX', 'ZD', 'PJZ', 'TQJG', 'TBZJL', 'SL', 'SR']
})
});
store.addListener({
beforeload: function (store, records, options) {
Ext.getBody().mask("数据重新加载中,请稍等");
}
});
store.load({ params: { start: 0, limit: 100000 }, callback: function (records, options, success) { Ext.getBody().unmask(); } });
return store;
}
function cs_(url) {
var store = new Ext.data.GroupingStore({
proxy: new Ext.data.HttpProxy({ url: url }),
sortInfo: { field: "ND", direction: "ASC" },
groupField: "ND",
reader: new Ext.data.JsonReader({
totalProperty: 'total',
root: 'rows',
successProperty: 'success',
fields: ['DWDM', 'AZFS', 'ND', 'MXMC', 'ZX', 'ZD', 'PJZ', 'TQJG', 'TBZJL', 'SL', 'SR']
})
});
store.addListener({
beforeload: function (store, records, options) {
Ext.getBody().mask("数据重新加载中,请稍等");
}
});
store.load({ params: { start: 0, limit: 100000 }, callback: function (records, options, success) { Ext.getBody().unmask(); } });
return store;
} //总和
var summary = new Ext.ux.grid.GridSummary();
//墓型销售全局变量
var MXXSTOTAL = "";
var cm = new Ext.grid.ColumnModel([
{ header: "陵园代码", hidden: true, sortable: true, dataIndex: 'DWDM', width: 100 }
, { header: "安葬方式", sortable: true, dataIndex: 'AZFS', width: 100 }
, { header: "年度", sortable: true, hidden: true, dataIndex: 'ND', width: 100 }
, { header: "墓型名称", sortable: true, hidden: true, dataIndex: 'MXMC', width: 100
, summaryType: 'count',
summaryRenderer: function (val, params, data) {
return val ? ((val == 0 || val > 0) ? '<span style="font-weight:bold;font-size:15;color:#0000FF" >合计:共(' + val + ')条' : '(1)') : '' + '</span>';
MXXSTOTAL = val;
}
}
, { header: "最小值", sortable: true, dataIndex: 'ZX', width: 100 }
, { header: "最大值", sortable: true, dataIndex: 'ZD', width: 100 }
, { header: "平均值", sortable: true, dataIndex: 'PJZ', width: 100 }
, { header: "去年同期", sortable: true, dataIndex: 'TQJG', width: 100 }
, { header: "同比增率", sortable: true, dataIndex: 'TBZJL', width: 100 }
, { header: "本年数量", sortable: true, dataIndex: 'SL', width: 100 }
, { header: "本年收入", sortable: true, dataIndex: 'SR', width: 100 }
]);
var cm_ = new Ext.grid.ColumnModel([
{ header: "陵园代码", sortable: true, dataIndex: 'DWDM', width: 100 }
, { header: "安葬方式", sortable: true, dataIndex: 'AZFS', width: 100 }
, { header: "年度", sortable: true, hidden: true, dataIndex: 'ND', width: 100 }
, { header: "墓型名称", sortable: true, hidden: true, dataIndex: 'MXMC', width: 100
, summaryType: 'count',
summaryRenderer: function (val, params, data) {
return val ? ((val == 0 || val > 0) ? '<span style="font-weight:bold;font-size:15;color:#0000FF" >合计:共(' + val + ')条' : '(1)') : '' + '</span>';
MXXSTOTAL = val;
}
}
, { header: "最小值", sortable: true, dataIndex: 'ZX', width: 100 }
, { header: "最大值", sortable: true, dataIndex: 'ZD', width: 100 }
, { header: "平均值", sortable: true, dataIndex: 'PJZ', width: 100 }
, { header: "去年同期", sortable: true, dataIndex: 'TQJG', width: 100 }
, { header: "同比增率", sortable: true, dataIndex: 'TBZJL', width: 100 }
, { header: "本年数量", sortable: true, dataIndex: 'SL', width: 100 }
, { header: "本年收入", sortable: true, dataIndex: 'SR', width: 100 }
]);
//单位查询下拉框Store
var store_DW = new Ext.data.JsonStore({
url: "/YWBLDJ/SelectDWMC_Data"
, totalProperty: 'total'
, root: 'rows'
, fields: [{ name: 'DWDM' }, { name: 'DWMC'}]
});
//单位查询
var combDW = new Ext.form.ComboBox({
emptyText: '请选择'
, id: 'comb_DWCX'
, width: 200
, triggerAction: 'all'
, lazyRender: true
, valueField: 'DWDM'
, displayField: 'DWMC'
, store: store_DW
, allowBlank: false
, lazyRender: true
, listClass: 'x-combo-list-small'
})
grid = new Ext.grid.GridPanel({
labelAlign: 'center',
plugins: [summary],
store: store,
cm: cm,
frame: true,
view: views,
tbar: [
{ xtype: 'tbtext', text: '单位名称:' }, combDW, '-',
{ text: '墓型', pressed: true, handler: function () { query("mx"); }, iconCls: 'searchIcon' }
, '-'
, { text: '年度', pressed: true, handler: function () { query("date"); }, iconCls: 'searchIcon' }
],
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight,
title: '墓碑价格分析表',
loadMask: { msg: '正在加载数据,请稍侯……' },
renderTo: 'grid',
loadMask: true
}); function query(typ) {
var lymc = Ext.getCmp("comb_DWCX").getValue();
if (lymc == "") {
var r = window.confirm("没有输入查询条件,这样可能造成查询时间超长,确认查询?");
if (!r) { return; }
}
var url = "/MXJGFX/GetMXND?" + "lymc=" + lymc + "";
if (typ == "mx") {
store = cs(url);
grid.reconfigure(store, cm);
} else { store = cs_(url);
grid.reconfigure(store, cm_);
} }
});
</script>
extjs分组查询的更多相关文章
- MySQL时间分组查询
表TESTER 字段:id -- INT date -- TIMESTAMP 1.如何按年.月.日分组查询? select DATE_FORMAT(date,'%Y-%m-%d') time, ...
- 关系数据库SQL之基本数据查询:子查询、分组查询、模糊查询
前言 上一篇关系数据库常用SQL语句语法大全主要是关系型数据库大体结构,本文细说一下关系型数据库查询的SQL语法. 语法回顾 SELECT [ALL|DISTINCT] <目标列表达式>[ ...
- Hibernate 分组查询 子查询 原生SQL
分组查询: 使用group by关键字对数据分组,使用having关键字对分组数据设定约束条件,从而完成对数据分组和统计 1.1 聚合函数:常被用来实现数据统计功能 ① count() 统计记录条数 ...
- mysql 分组查询问题 group_concat
这几天在做购物车的时候.购物车内的商品为一个商品占一行,结果再从数据库读出的时候,没有分组,而是循环所有的内容出来,然后进行判断.如果一样的话就把他保存到一个变量中.但是自己逻辑没搞清楚.一直出bug ...
- mongodb 分组查询
数据的保存 include_once 'mDB.class.php'; $m=new mDB(); $m->setDB('mydb'); // $m->save('stu',['dept' ...
- 08章 分组查询、子查询、原生SQL
一.分组查询 使用group by关键字对数据分组,使用having关键字对分组数据设定约束条件,从而完成对数据分组和统计 1.1 聚合函数:常被用来实现数据统计功能 ① count() 统计记录条数 ...
- Mongodb for C# 分组查询
#region 排序获取集合 static List<BsonDocument> GetPagerWithGroup(string connectionString, string dat ...
- SQL分组查询group by
注意:select 后的字段,必须要么包含在group by中,要么包含在having 后的聚合函数里. 1. GROUP BY 是分组查询, 一般 GROUP BY 是和聚合函数配合使用 group ...
- SQL group by分组查询(转)
本文导读:在实际SQL应用中,经常需要进行分组聚合,即将查询对象按一定条件分组,然后对每一个组进行聚合分析.创建分组是通过GROUP BY子句实现的.与WHERE子句不同,GROUP BY子句用于归纳 ...
随机推荐
- ashx与验证码
using System; using System.Drawing; using System.Drawing.Imaging; using System.Drawing.Drawing2D; us ...
- [SQL SERVER系列]读书笔记之SQL注入漏洞和SQL调优
最近读了程序员的SQL金典这本书,觉得里面的SQL注入漏洞和SQL调优总结得不错,下面简单讨论下SQL注入漏洞和SQL调优. 1. SQL注入漏洞 由于“'1'='1'”这个表达式永远返回 true, ...
- SpringJUnit4加载类目录下(src)和WEF-INF目录下的配置文件
路径说明: 一.加载类目录下的配置文件 @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:ap ...
- PHP session有效期session.gc_maxlifetime的设置方法
PHP(外文名: Hypertext Preprocessor,中文名:“超文本预处理器”)是一种通用开源脚本语言.语法吸收了C语言.Java和Perl的特点,入门门槛较低,易于学习,使用广泛,主要适 ...
- 详细解析: VictorOps 是如何利用和完善 ChatOps?
ChatOps,即聊天应用,在软件开发中被广泛应用改进开发者之间的沟通.简单地说,ChatOps 是将内容或行动 (或两者) 迁移到聊天客户端.这样做之后,企业内的所有团队都能分享重要信息,行动,及其 ...
- 【形式化方法:VDM++系列】4.VDM实战1——铁路费用计算
又有将近2个月没更新博客了啊!winter holiday简直玩儿疯了的说!结果假期前学习的形式化方法已经忘了大半!面对期末作业,大脑一片空白.于是,赶快复习了一下之前学习的姿势! 这次的主要任务是完 ...
- hdu 2897 邂逅明下 博弈论
这个分区间: 1<=n%(p+q)<=p 必败 其他必胜! 代码如下: #include<iostream> #include<stdio.h> #include& ...
- IText PdfPTable表格 单元的居中显示
昨晚寻找了网上很多关于IText表格居中问题,他们其中的有些代码我即使复制上去生成的doc表格的文字都是不居中的,后来我自己找出了一种居中方式: 为PdfPCell对象添加paragraph对象,并将 ...
- P73、面试题9:斐波那契数列
题目一:写一个函数,输入n,求斐波那契数列(Fibonacci)数列的第n项,斐波那契数列的定义如下: f(n) = {0 n = 0; 1 n = 1; f(n-1)+f(n-2) n& ...
- GCC编译警告和错误
1 error: expected expression before 'else' else之前无表达式. 2 error: lvalue required as left operand of a ...