bootstrap-table方法之:合併單元格

方法一 經過mergeCells方法

演示地址:http://issues.wenzhixin.net.cn/bootstrap-table/methods/mergeCells.htmlhtml

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});json

功能描述:合併單元格bootstrap

 

方法一 經過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"
                    }
                ]
            ]
        })
相關文章
相關標籤/搜索