JS dataTables.fixedHeader标头和数据之间的宽度不同

ale*_*ire 7 html javascript datatable fixed-header-tables

我使用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>
Run Code Online (Sandbox Code Playgroud)

JS:

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

填充:

$('#custTable').dataTable().fnAddData([
               xyz, xyz, xyz, ...
                        ]);
Run Code Online (Sandbox Code Playgroud)

Bar*_*won 3

禁用自动列宽。

JS

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

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