【问题标题】:How to set column width in datatable [closed]如何在数据表中设置列宽[关闭]
【发布时间】:2014-06-29 12:23:03
【问题描述】:

我有一个表格,我想调整表格列的大小

$("#tableSortable").dataTable({
        "bAutoWidth": false,
        "aoColumns": [
        { sWidth: '1%' },
        { sWidth: '1%' },
        { sWidth: '1%' },
        { sWidth: '1%' } ]
    });
    tableSortable.fnDraw();
});

【问题讨论】:

  • 那么你的问题是什么?
  • 表格的组合单元格应加起来为 100% 宽度,因此将所有单元格设置为 1% 永远不会有效果。

标签: php jquery datatables width


【解决方案1】:

在 cmets Rory McCrossan 中提到过。是的,表格的组合单元格应该是 100%

好吧,在你的情况下,有 4 列,然后是它非常直的远字。

"aoColumns": [
        { sWidth: '25%' },
        { sWidth: '25%' },
        { sWidth: '25%' },
        { sWidth: '25%' } ]

如果你想用不同的方式来做,你可以设置 bAutoWidth:True 。

问候

【讨论】:

    猜你喜欢
    • 2018-03-28
    • 2019-08-08
    • 2017-02-07
    • 2013-11-18
    • 2011-08-01
    • 1970-01-01
    • 2019-12-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多