方法一 通过mergeCells方法
演示地址:http://issues.wenzhixin.net.cn/bootstrap-table/methods/mergeCells.html
Merge some cells to one cell, the options contains following properties:
index: the row index.
field: the field name.
rowspan: the rowspan count to be merged.
colspan: the colspan count to be merged.$table.bootstrapTable('mergeCells', {index: 1, field: 'name', colspan: 2, rowspan: 3});
功能描述:合并单元格
方法一 通过columns参数中存放数组的形式
例:
$("#table").bootstrapTable({ dataType: "json", method: 'get', contentType: "application/x-www-form-urlencoded", cache: false, url:"../data/mergeData.json", columns:[ [ { "title": "洗衣机统计表", "halign":"center", "align":"center", "colspan": 5 } ], [ { field: 'name', title: "功能分组", valign:"middle", align:"center", colspan: 1, rowspan: 2 }, { title: "美的", valign:"middle", align:"center", colspan: 2, rowspan: 1 }, { title: "松下", valign:"middle", align:"center", colspan: 2, rowspan: 1 } ], [ { field: 'mideaNum', title: '数量', valign:"middle", align:"center" }, { field: 'mideaPercent', title: '占比', valign:"middle", align:"center" }, { field: 'panasonicNum', title: '数量', valign:"middle", align:"center" }, { field: 'panasonicPercent', title: '占比', valign:"middle", align:"center" } ] ] })