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

JS dataTables.fixedHeader different width between header and datas

我使用 javascript 插件 dataTables.fixedHeader 并用 ajax 填充数据。 现在我遇到了问题,每个 data-column 的宽度是动态的,而 header 保持相同的静态宽度。

代码:

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