【问题标题】:Datatables: 'bAutoWidth: false' not working when 'sScrollY' is set数据表:设置 'sScrollY' 时,'bAutoWidth: false' 不起作用
【发布时间】:2014-01-14 01:56:02
【问题描述】:

我正在使用数据表在页面加载后重新格式化已经存在的表/DOM。我在thead中以百分比形式定义了列宽

  <table border="1" style="table-layout: fixed; word-wrap: break-word;"
                    id='myTable'>
                    <thead>
                        <tr>
                            <th>GroupName</th>
                            <th style='width: 60%;'>Grouped By </th>
                            <th style='width: 15%;'>Count</th>
                            <th style='width: 25%;'>Download</th> 
                        </th>
                    </thead>
                    <tbody>....</tbody>
 </table>

JQuery 代码如下所示。

oTable = jq("#myTable").dataTable(
     {
        "bSort" : false,
        "bLengthChange" : false,
        "bJQueryUI" : true,
        "bPaginate" : false,
        "sScrollY": "200px",
        "bAutoWidth": false // Disable the auto width calculation 
    }).rowGrouping(
    {
        bExpandableGrouping : true //group by first column
    });

问题是 - 设置 sScrolly 时,数据表会自动计算宽度并为所有列设置相等的宽度,因为 bAutoWidth 设置为 false。在禁用它时,列宽将根据百分比进行适当设置。 有关如何使其工作的任何建议?

谢谢

【问题讨论】:

    标签: jquery datatable


    【解决方案1】:

    我在数据表论坛上发布了问题,并从作者那里得到了答案/修复。 万一有人在这里偶然发现
    http://www.datatables.net/forums/discussion/19089/datatables-039bautowidth-false039-not-working-when-039sscrolly039-is-set#Item_1

    【讨论】:

      猜你喜欢
      • 2016-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-04
      • 1970-01-01
      相关资源
      最近更新 更多