码迷,mamicode.com
首页 > 其他好文 > 详细

EasyUI DataGrid 多级表头设置

时间:2020-02-25 13:08:18      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:use   tco   单元格   添加   user   lse   测评   code   alt   

使用EasyUI做一个报表统计,需要合并表头为多级表头,核心代码如下:

$(‘#dg‘).datagrid({  
    url:‘datagrid_data.action‘,  
    fit : true,
    fitColumns : false,
    columns:
         [
             [
                {"title":"网格员考核测评表","colspan":9}
             ],
             [
                {"field":"ORGNAME","title":"网格","rowspan":3,width:"80"},
                {"field":"USERZH","title":"网格员","rowspan":3,width:"80"},
                {"title":"工作纪律","rowspan":2},
                {"title":"民主互评","rowspan":2},
                {"title":"志愿者","rowspan":2},
                {"title":"加分项","colspan":2},
                {"title":"总分","rowspan":2},
                {"title":"平均分","rowspan":2}
             ],
             [
                {"title":"信息上报","rowspan":1},
                {"title":"简报采纳","rowspan":1}
             ],
             [
                {"field":"YW1","title":"5分","rowspan":1},
                {"field":"YW2","title":"5分","rowspan":1},
                {"field":"YW3","title":"6分","rowspan":1},
                {"field":"YW4","title":"8分","rowspan":1},
                {"field":"YW5","title":"5分","rowspan":1},
                {"field":"TOTAL","title":"","rowspan":1},
                {"field":"AVG","title":"","rowspan":1}
             ]
         ]
}); 

效果如图:

技术图片

从以上代码和图中可以看出表头共有4行9列, 画单元格就和HTML中一样,主要利用 rowspan、colspan 属性

在将要显示内容的列上添加 field 属性

EasyUI DataGrid 多级表头设置

标签:use   tco   单元格   添加   user   lse   测评   code   alt   

原文地址:https://www.cnblogs.com/chenyanbin/p/12360823.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!