<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分组查询的更多相关文章

  1. MySQL时间分组查询

    表TESTER 字段:id -- INT    date  -- TIMESTAMP 1.如何按年.月.日分组查询? select DATE_FORMAT(date,'%Y-%m-%d') time, ...

  2. 关系数据库SQL之基本数据查询:子查询、分组查询、模糊查询

    前言 上一篇关系数据库常用SQL语句语法大全主要是关系型数据库大体结构,本文细说一下关系型数据库查询的SQL语法. 语法回顾 SELECT [ALL|DISTINCT] <目标列表达式>[ ...

  3. Hibernate 分组查询 子查询 原生SQL

    分组查询: 使用group by关键字对数据分组,使用having关键字对分组数据设定约束条件,从而完成对数据分组和统计 1.1 聚合函数:常被用来实现数据统计功能 ① count() 统计记录条数 ...

  4. mysql 分组查询问题 group_concat

    这几天在做购物车的时候.购物车内的商品为一个商品占一行,结果再从数据库读出的时候,没有分组,而是循环所有的内容出来,然后进行判断.如果一样的话就把他保存到一个变量中.但是自己逻辑没搞清楚.一直出bug ...

  5. mongodb 分组查询

    数据的保存 include_once 'mDB.class.php'; $m=new mDB(); $m->setDB('mydb'); // $m->save('stu',['dept' ...

  6. 08章 分组查询、子查询、原生SQL

    一.分组查询 使用group by关键字对数据分组,使用having关键字对分组数据设定约束条件,从而完成对数据分组和统计 1.1 聚合函数:常被用来实现数据统计功能 ① count() 统计记录条数 ...

  7. Mongodb for C# 分组查询

    #region 排序获取集合 static List<BsonDocument> GetPagerWithGroup(string connectionString, string dat ...

  8. SQL分组查询group by

    注意:select 后的字段,必须要么包含在group by中,要么包含在having 后的聚合函数里. 1. GROUP BY 是分组查询, 一般 GROUP BY 是和聚合函数配合使用 group ...

  9. SQL group by分组查询(转)

    本文导读:在实际SQL应用中,经常需要进行分组聚合,即将查询对象按一定条件分组,然后对每一个组进行聚合分析.创建分组是通过GROUP BY子句实现的.与WHERE子句不同,GROUP BY子句用于归纳 ...

随机推荐

  1. 【HDU2222】Keywords Search

    Problem DescriptionIn the modern time, Search engine came into the life of everybody like Google, Ba ...

  2. 在Hadoop分布式文件系统的索引和搜索

    FROM:http://www.drdobbs.com/parallel/indexing-and-searching-on-a-hadoop-distr/226300241?pgno=3 在今天的信 ...

  3. iOS定位坐标转换工具-b

    坐标系介绍 首先介绍一下目前的定位坐标系统1.地球坐标 :( 代号:GPS.WGS84 )--- 有W就是世界通用的也就是原始坐标体系,这是国际公认的世界标准坐标体系: 使用 WGS84 坐标系统的产 ...

  4. REST Design Concerns

    Less Requests, More data; one of the core RESTful API design paradigms is the concept of less API re ...

  5. linux 下安装JDK1.7

    安装JDK1.7 1. 打开网址http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u5-downloads-1591156.ht ...

  6. 团体程序设计天梯赛-练习集L1-002. 打印沙漏

    L1-002. 打印沙漏 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 本题要求你写个程序把给定的符号打印成沙漏的形状.例如给 ...

  7. 获取属性名:PropertyNameHelper

    获取属性名:PropertyNameHelper namespace NCS.Infrastructure.Querying { public static class PropertyNameHel ...

  8. uva 11461

    简单 打个表 case数不超过200 数据比较水  木有超时的风险~~ /*************************************************************** ...

  9. Android 二维码扫描与生成

    由于源代码比较多,本文不进行讲述,请下载源码. 源码来源于网络,请点击这里下载: http://files.cnblogs.com/wuyou/Android%E4%BA%8C%E7%BB%B4%E7 ...

  10. 全选与反选(dom与jquery比较)

    <html> <head> <title>全选或反选(dom)</title> <meta http-equiv="Content-Ty ...