数据表 Javascript 显示水平滚动条

Datatable Javascript shows horizontal scroller bar

本文关键字:滚动条 水平 显示 Javascript 数据表      更新时间:2023-09-26

你能帮忙吗?

   <table id="myTable">
                    <thead>
                        <tr/>
                    </thead>
<tbody/>
                </table> 

    "bJQueryUI": false,
    "bProcessing": false,
    "bServerSide": true,
    "bFilter": true,
    "bAutoWidth": false,
    "bDeferRender": true,
    "bScrollCollapse": true,
    "oScroller": {
        serverWait: true
    },
    "bInfo": true,
    "aaSorting": [
        [1, 'asc']
    ], // Default first column sort
    "sDom": 'tiS',

表格在滚动时不断调整自身大小

我认为您的表结构是根据数据表进行的,请尝试创建这样的表:

<table class="display" id="example">
    <thead>
        <tr>
            <th>Title 1</th>
            <th>Title 2</th>
            <th>Title 3</th>
        </tr>
    </thead>
    <tbody>
         <tr>
            <td>Res 1</td>
            <td>Res 2</td>
            <td>Res 3</td>
         </tr>
    </tbody>
</table>

如果需要,则无法设置<tfoot>

试试这个,如果有效,设置$("#example").dataTable({...});