数据表宽度问题

Tsu*_*oku 1 jquery jquery-plugins datatables

我正在使用带有 jQ​​uery 的 DataTables 插件,并且我已经查看了 StackOverflow 并发现了另一个问题几乎相同的问题(除了我没有选项卡),我尝试了它在那里所说的但无法使其工作。我在表格中有这个下拉菜单,只显示 50 条记录(下面代码中的 iDisplayLenth),当您选择 100 或超过表格时,表格会完全调整大小,我不知道为什么。任何帮助或建议将不胜感激。这是我用于创建表格的 HTML:

<table id="content-table-redesign" class="display">
Run Code Online (Sandbox Code Playgroud)

然后是与之相关的css

#content-table-redesign{border-collapse: separate;width:1241px;margin:0 auto;}
#content-table-redesign th{min-width:45px;color:#2e2e2e;}
Run Code Online (Sandbox Code Playgroud)

和在这一点上的 js 几乎是我最初拥有的和我在另一个链接上找到的建议的混合。一切都在 $document(function(){}); 内完成;

var oTable = $('#content-table-redesign').dataTable({
        "oLanguage": {
            "sLengthMenu": "Display _MENU_ records per page",
            "sZeroRecords": "Nothing found - sorry",
            "sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
            "sInfoEmpty": "Showing 0 to 0 of 0 records",
            "sInfoFiltered": "(filtered from _MAX_ total records)"
        },
        "aaSorting": [[ 0, "asc" ]],
        "bAutoWidth": false,
        "iDisplayLength": 50,
        "aLengthMenu": [10, 20, 30, 50, 100, 500],
        "sPaginationType": "full_numbers",
        "sDom": '<"top"i><"#up"f>rt<"#bottom2"l><"pagin"p><"clear">',
        "aoColumns" : [
            { sWidth: '500px' },
            { sWidth: '1000px' },
            { sWidth: '1200px' },
            { sWidth: '300px' },
            { sWidth: '100px' },
            { sWidth: '120px' },
            { sWidth: '30px' },
            { sWidth: '100px' },
            { sWidth: '120px' }
        ] 
    });

    oTable.fnAdjustColumnSizing();
Run Code Online (Sandbox Code Playgroud)

我刚刚意识到这个错误只出现在 IE8 和 Chrome 12+ 上

小智 5

var oTable = $('#contactsTable').dataTable( {
  "bAutoWidth": false

});
Run Code Online (Sandbox Code Playgroud)

添加此代码