下面是我项目中和网上收集的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. nginx android app 慢网络请求超时

    最近遇到了android 在慢网络下面请求服务器报 java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by ...

  2. Devexpress

    1.隐藏最上面的GroupPanel gridView1.OptionsView.ShowGroupPanel=false; 2.得到当前选定记录某字段的值 sValue=Table.Rows[gri ...

  3. Essential controls for web app

    AUTO-COMPLETE/AUTO-SUGGEST Auto-complete using Vaadin Offer auto-suggest or auto-complete to help yo ...

  4. Usaco*Brownie Slicing

    Description Bessie烘焙了一块巧克力蛋糕.这块蛋糕是由R*C(1 <= R,C <= 500)个小的巧克力蛋糕组成的. 第i行,第j列的蛋糕有N_ij(1 <= N_ ...

  5. 有关于canvas几个新知识点

    对于canvas的初学者来说,以下几点应该是不知道的知识点: 1.canvas有兼容IE6/7/8的脚本文件 下载地址:https://github.com/arv/explorercanvas 2. ...

  6. mysql添加一个用户

    对于添加mysql的远程访问用户,一定要记得刷新刷新系统权限表不然你怎么弄都是不成功的. insert into mysql.user(Host,User,Password) values(" ...

  7. nginx 软连接

    ln -s 目标地址 源地址 ln -s ../../../web-admin/etc/nginx-location.conf web-admin.conf

  8. 在SharePoint 2010中,如何找回丢失的服务账号(Service Account)密码

    背景信息: 通常在SharePoint环境中我们会使用很多的服务账号来运行各种不同的服务,尤其在企业环境中,由于权限管理条例严格,这些服务账号更是只能多不能少.面对如此多的服务账号,各个企业都会有自己 ...

  9. Spring MVC中Session的正确用法<转>

    Spring MVC是个非常优秀的框架,其优秀之处继承自Spring本身依赖注入(Dependency Injection)的强大的模块化和可配置性,其设计处处透露着易用性.可复用性与易集成性.优良的 ...

  10. 微软开源.NET Core的执行引擎CoreCLR{转载}

    继去年12月宣布.NET Core开源之后,微软拥抱开源的决心又向前迈了一步,Microsoft于昨日在 .NET Framework Blog上 宣布开源.NET Core 的执行引擎 CoreCL ...