1. 程式人生 > >BootStrapTable.js 表頭與內容無法對齊

BootStrapTable.js 表頭與內容無法對齊

去掉 height 屬性的配置即可保證資料表格的表頭部分與資料部分對齊。

程式碼詳例如下:

$(function () {
        $("#serviceTable").bootstrapTable({
            // for the Name of Package then appended system
            url:'/service/ServiceList.action',
//            height: 500,
            dataType: "json",
            striped: true,//row color
            cache: false,
            undefinedText: "-",
            sortName: "serviceId",
            sortOrder: "asc",
            pagination: true,
            sidePagination: "server",
            toolbar: "#toolbar",
            pageNumber:1,
            pageSize:5,
            pageList:[5,10,25,50],
            paginationPreText: "上一頁",
            paginationNextText: "下一頁",
            columns: [{
                checkbox: true
            }, {
                field: "serviceName",
                title: "權益名稱",
                align: 'center'
            },{
                field: 'serviceId',
                title:'操作',
                align:'center',
                formatter:function(value,row,index){
                    var serviceId = row.serviceId;
                    var a = '<a href="/service/csServiceAction_goCsServiceJsp.action?csService.serviceId='+serviceId+'" class="cs_menuTab">編輯</a>';
                    return a;
                }
            }]
        });
    });