Jquery DataTables - Table width is shorter than dataTable_wrapper width

自古美人都是妖i 提交于 2020-02-05 04:02:04

问题


How do I correct the issue with the .dataTables_wrapper width being larger than the actual table data width? (using autowidth for the table data). I am using oTable.fnAdjustColumnSizing(); to resize the columns after the page is loaded. Everything looks fine for the column widths, but the wrapper is still too large.

var oTable = $('.admin_users').dataTable({
        "aaSorting": [[ 0, "desc" ]],
        "bJQueryUI": true,
        "sPaginationType": "full_numbers",
      //  "sAjaxSource": 'SQL/dataTable.php',
        "bStateSave": true, //Use a cookie to save current display of items
        "aoColumns": [
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            { "sType": "date", "sClass":"center" }
        ]

    });
    oTable.fnAdjustColumnSizing();

回答1:


Found the solution: Add this to the table initilization

"fnInitComplete": function() {
                oTable.fnAdjustColumnSizing();
         }


来源:https://stackoverflow.com/questions/8014658/jquery-datatables-table-width-is-shorter-than-datatable-wrapper-width

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!