簡體   English   中英

JS dataTables.fixedHeader標頭和數據之間的寬度不同

[英]JS dataTables.fixedHeader different width between header and datas

我使用javascript插件dataTables.fixedHeader並用ajax填充數據。 現在我遇到的問題是,每個數據列的寬度是動態的,並且標題保持在相同的靜態寬度上。

寬度不同

碼:

HTML:

<table class="table table-striped table-bordered table-hover" id="custTable">
                    <thead>
                        <tr>
                            <th>
                                ......
                            </th>
                            <th>
                                ......
                            </th>
                            <th>
                                ......
                            </th>
......
                        </tr>
                    </thead>
                    <tbody id="dataList"></tbody>
                </table>

JS:

table = $('#custTable').DataTable({
            "dom": "frtiS",
            "deferRender": true,
        });

填充:

$('#custTable').dataTable().fnAddData([
               xyz, xyz, xyz, ...
                        ]);

禁用自動列寬。

JS

table = $('#custTable').DataTable({
            "dom": "frtiS",
            "deferRender": true,
            "autoWidth": false
        });

http://datatables.net/reference/option/autoWidth

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM