关于bootstrap table 固定列宽

首先为table 设置 style="table-layout: fixed;"
 <table id="assessStage" data-height="467" data-mobile-responsive="true" style="table-layout: fixed;">
                </table>
然后在下方columns 处设置width
$('#assessStage').bootstrapTable({
            method: 'get',
            url: "xxx",
            btn: true,
            pagination: true,
            pageSize: 10,
            pageNumber: 1,
            pageList: [10, 15, 30],//分页步进值
            striped: true,
            dataField: "list",
            iconSize: 'outline',
            icons: {
                refresh: 'glyphicon-repeat',
                toggle: 'glyphicon-list-alt',
                columns: 'glyphicon-list'
            },
            columns: [
                [
                    {
                        field: 'student_name',
                        title: '姓名',
                        align: 'center',
                        colspan: 1
                        ,width:100
                    },
                    {
                        field: 'hospital_name',
                        title: '带教单位',
                        align: 'center',
                        colspan: 1
                        ,width:200
                    },
                    {
                        field: 'teacher_name',
                        title: '指导老师',
                        align: 'center',
                        colspan: 1
                        ,width:100
                    },
                    {
                        field: 'start_time',
                        title: '开始时间',
                        align: 'center',
                        colspan: 1,
                        width:100
                    }
                ]
            ]
        });

posted @ 2019-12-04 11:39  那些年的代码  阅读(11523)  评论(1编辑  收藏  举报