繁体   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