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


方法一 通過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"
                    }
                ]
            ]
        })

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM