下面是我项目中和网上收集的EasyUI的表头处理的,合适的拿去用吧.
例子1:
$('#day_health').datagrid({
                url: "sqb_bweb_day_health.aspx?mode=day_health",
                pagination: true,
                total: 2000,
                pageSize: 10,
                pageList: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
                rownumbers: true,
                fit: true,        //自动大小
                fitColumns: true, //自适应列宽
                singleSelect: true,  //是否单选
                idField: 'Project_id',
                columns: [[
                    {title:'一组',colspan:3},
                    {field:'opt',title:'Operation',width:100,align:'center', rowspan:2,
                        formatter:function(value,rec){
                            return '<span style="color:red">Edit Delete</span>';
                        }
                    },
                    {title:'二组',colspan:3}
                ],[ 
                    {field:'name',title:'Name',width:120,rowspan:1},
                    {field:'addr',title:'Address',width:220,rowspan:1,sortable:true,
                        sorter:function(a,b){
                            return (a>b?1:-1);
                        }
                    },
                    {field:'col4',title:'Col41',width:150,rowspan:1},
                        {field:'name1',title:'Name1',width:120,rowspan:1},
                    {field:'addr1',title:'Address1',width:220,rowspan:1,sortable:true,
                        sorter:function(a,b){
                            return (a>b?1:-1);
                        }
                    },
                    {field:'col41',title:'Col411',width:150,rowspan:1}
                ]]
            });



例子2:
View Demo

In this example, we use flat data to populate the DataGrid data, and group the listprice,unitcost,addr1,status columns under a single column.

To create column groups you should defines the columns property of datagrid plugin. Each element of columns is a definition of group which can use rowspan or colspan property to combine cells together.

The following code implements above example:

  1. <table id="tt" title="Column Group" class="easyui-datagrid" style="width:550px;height:250px"
  2. url="data/datagrid_data.json"
  3. singleSelect="true" iconCls="icon-save" rownumbers="true">
  4. <thead>
  5. <tr>
  6. <th rowspan="2" field="itemid" width="80">Item ID</th>
  7. <th rowspan="2" field="productid" width="80">Product ID</th>
  8. <th colspan="4">Item Details</th>
  9. </tr>
  10. <tr>
  11. <th field="listprice" width="80" align="right">List Price</th>
  12. <th field="unitcost" width="80" align="right">Unit Cost</th>
  13. <th field="attr1" width="100">Attribute</th>
  14. <th field="status" width="60" align="center">Stauts</th>
  15. </tr>
  16. </thead>
  17. </table>



  18. 例子3:
                                    <table id="dg" style="width:890px;height:305px;" data-options="                    
                        singleSelect:true,
                        autoRowHeight:false
                        ">
                                        <thead>
                                            <tr>
                                                <th rowspan="2" field="inv" width="170" align="center">年度</th>
                                                <th colspan="2" width="230" align="center">2014</th>
                                                <th colspan="2" width="230" align="center">2013</th>
                                                <th colspan="2"  width="230" align="center">2012</th>
                                            </tr>
                                            <tr>
                                                <th field="amount" width="115" align="center">实时采集</th>
                                                <th field="price" width="115" align="center">结算记录</th>
                                                <th field="cost" width="115" align="center">实时采集</th>
                                                <th field="note" width="115" align="center">结算记录</th>
                                                <th field="date" width="115" align="center">实时采集</th>
                                                <th field="name" width="115" align="center">结算记录</th>
                                        </thead>

    </table>


    示图:
     



JQuery EasyUI datagrid 复杂表头处理的更多相关文章

  1. 转载 -- jquery easyui datagrid 动态表头 + 嵌套对象属性展示

    代码功能: 1.datagrid 的表头由后台生成,可以配置在数据库 2.datagrid 的列绑定数据 支撑嵌套对象 $(function() { var columns = new Array() ...

  2. JQuery Easyui/TopJUI 多表头创建

    JQuery Easyui/TopJUI 多表头创建 废话不多说,直接贴上代码. html <div data-toggle="topjui-layout" data-opt ...

  3. jQuery EasyUI datagrid实现本地分页的方法

    http://www.codeweblog.com/jquery-easyui-datagrid%e5%ae%9e%e7%8e%b0%e6%9c%ac%e5%9c%b0%e5%88%86%e9%a1% ...

  4. jQuery EasyUI DataGrid Checkbox 数据设定与取值

    纯粹做个记录,以免日后忘记该怎么设定. 这一篇将会说明两种使用 jQuery EasyUI DataGrid 的 Checkbox 设定方式,以及在既有数据下将 checked 为 true 的该笔数 ...

  5. jquery easyui datagrid使用参考

    jquery easyui datagrid使用参考   创建datagrid 在页面上添加一个div或table标签,然后用jquery获取这个标签,并初始化一个datagrid.代码如下: 页面上 ...

  6. Jquery easyui datagrid 导出Excel

    From:http://www.cnblogs.com/weiqt/articles/4022399.html datagrid的扩展方法,用于将当前的数据生成excel需要的内容. 1 <sc ...

  7. jquery easyui datagrid 获取Checked选择行(勾选行)数据

    原文:jquery easyui datagrid 获取Checked选择行(勾选行)数据 getSelected:取得第一个选中行数据,如果没有选中行,则返回 null,否则返回记录. getSel ...

  8. 扩展jquery easyui datagrid编辑单元格

    扩展jquery easyui datagrid编辑单元格 1.随便聊聊 这段时间由于工作上的业务需求,对jquery easyui比较感兴趣,根据比较浅薄的js知识,对jquery easyui中的 ...

  9. jquery easyui datagrid 加每页合计和总合计

    jquery easyui datagrid 加每页合计和总合计 一:效果图 二:代码实现 这个只有从后台来处理 后台根据rows 和page两个参数返回的datatable 命名为dt 然后根据dt ...

随机推荐

  1. C#中的null与void

    一.null: 1.明义,null是什么意思? null是指一个变量没有指向具体对象的有效引用. 这句话什么意思呢?意思就是 1).能够使用null修饰的是变量: 2).主要指的是引用. 那么这就引出 ...

  2. 关于zepto(相似于jquery、jQuery用于网页浏览器,zepto用于手机浏览器)

    http://blog.csdn.net/kongjiea/article/details/42522305   -----关于zepto和jquery的差别 jQuery 使用 .width() 和 ...

  3. HDU 2227 Find the nondecreasing subsequences (DP+树状数组+离散化)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2227 Find the nondecreasing subsequences             ...

  4. 安卓端360度全景图的html5实现

    这里是一款旅游相关的安卓应用,其中虚拟旅游的功能采用html5的360度全景图技术实现,使用户能够身临其境的感受旅游景点的风光. 此处引入了ddpanorama插件,它的原理是在canvas上绘制全景 ...

  5. 【luogu】 P1880 石子合并

    原题原题原题原题原题 先贴上错误代码... ↓错误代码↓ #include <iostream> #include <cstdio> #include <cstring& ...

  6. eclipse版本发展历史

    Eclipse百科 https://zh.wikipedia.org/wiki/Eclipse        # 中文维基百科 http://baike.baidu.com/subview/23576 ...

  7. 学习建模 - UML

    最轻量级的工具下载地址 http://staruml.io/download 下载解压依赖:libgcrypt11 https://pan.baidu.com/s/1i3wb6M5 学习地址 http ...

  8. requireJs--简单的使用方法

    简单使用: <!-- index.html部分 data-main 为入口 --> <script data-main="js/app.js" src=" ...

  9. 【五】将博客从jekyll迁移到了hexo

    本系列有五篇:分别是  [一]Ubuntu14.04+Jekyll+Github Pages搭建静态博客:主要是安装方面  [二]jekyll 的使用 :主要是jekyll的配置  [三]Markdo ...

  10. Quartz 2D在ios中的使用简述一:坐标体系

    Quartz 2D是一个二维图形绘制引擎,支持iOS环境和Mac OS X环境,官方文档:Quartz 2D Programming Guide. 一.坐标体系 这样的坐标体系就导致我们使用Quart ...