Jquery DataTables - 表宽度小于dataTable_wrapper宽度 [英] Jquery DataTables - Table width is shorter than dataTable_wrapper width

查看:423
本文介绍了Jquery DataTables - 表宽度小于dataTable_wrapper宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更正.dataTables_wrapper宽度大于实际表数据宽度的问题? (对表数据使用自动宽度)。
我正在使用oTable.fnAdjustColumnSizing();在加载页面后调整列的大小。对于列宽,一切看起来都很好,但包装器仍然太大。

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();


推荐答案

找到解决方案:
将此添加到表初始化

Found the solution: Add this to the table initilization

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

这篇关于Jquery DataTables - 表宽度小于dataTable_wrapper宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆