【发布时间】: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。在禁用它时,列宽将根据百分比进行适当设置。
有关如何使其工作的任何建议?
谢谢
【问题讨论】: