下面是我项目中和网上收集的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. openGL实现二维图形和三维图形

    openGL是一个强大的底层图形库,其命令最初的时候使用C语言实现的.openGL定义了一个图形程序接口,常用于制作处理三维图像,功能强大,调用方便,在图像处理十分受欢迎. 实现图形主要使用的是ope ...

  2. highchart 添加新的series

    code: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" c ...

  3. webform 分页、组合查询综合使用

    界面: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx ...

  4. StreamingAssets文件夹在不同平台上的引用

    On a desktop computer (Mac OS or Windows) the location of the files can be obtained with the followi ...

  5. "SQL Server does not handle comparison of NText, Text, Xml, or Image data types."

    "SQL Server does not handle comparison of NText, Text, Xml, or Image data types." sql2000 ...

  6. 国内2大Git代码托管网站

    可以说GitHub的出现完全颠覆了以往大家对代码托管网站的认识.GitHub不但是一个代码托管网站,更是一个程序员的SNS社区.GitHub真正迷人的是它的创新能力与Geek精神,这些都是无法模仿的. ...

  7. 一劳永逸:域名支持通配符,ASP.NET Core中配置CORS更轻松

    ASP.NET Core 内置了对 CORS 的支持,使用很简单,只需先在 Startup 的 ConfigureServices() 中添加 CORS 策略: public void Configu ...

  8. 企业IT管理员IE11升级指南【1】—— Internet Explorer 11增强保护模式 (EPM) 介绍

    企业IT管理员IE11升级指南 系列: [1]—— Internet Explorer 11增强保护模式 (EPM) 介绍 [2]—— Internet Explorer 11 对Adobe Flas ...

  9. 再探.NET的PE文件结构(安全篇)

    一.开篇 首先写在前面,这篇文章源于个人的研究和探索,由于.NET有自己的反射机制,可以清楚的将源码反射出来,这样你的软件就很容易被破解,当然这篇文章不会说怎么样保护你的软件不被破解,相反是借用一个软 ...

  10. 跨域获取json一些理解[腾讯电商数据的拉取方式]

    如何跨域获取json数据源?我们都知道要有callback,具体callback是如何工作的呢?如果服务器端不接收callback,我们是不是就没有办法处理了呢?读完本文后相信你会有一个大体的了解. ...