關於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
                    }
                ]
            ]
        });


免責聲明!

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



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