Jquery Datatable列宽重置问题
我想给js中的datatable(固定标题)提供最大宽度 我正在使用以下js更新datatable ssetting:Jquery Datatable列宽重置问题,jquery,html,css,datatables,Jquery,Html,Css,Datatables,我想给js中的datatable(固定标题)提供最大宽度 我正在使用以下js更新datatable ssetting: var oTable = $('#example').DataTable( { "sScrollY": 200, // "bScrollCollapse": true, // "bAutoWidth": true,
var oTable = $('#example').DataTable(
{
"sScrollY": 200,
// "bScrollCollapse": true,
// "bAutoWidth": true,
// "sScrollX": "100%",
// "sScrollXInner": "100%"
});
但应用“sScrollY”后,列宽设置不正确。
所以,我只想为每个
和
重置列宽
我已经试过了所有可能的方法
HTML代码:-
<section class="panel">
<header class="panel-heading">
Scheduled Outages
</header>
<div class="panel-body">
<div class="adv-table">
<table class="display table table-bordered table-striped" id="example1">
<thead>
<tr>
<th>Id</th>
<th>Planned Start Date</th>
<th>Planned End Date</th>
<th>D...</th>
<th class="hidden-phone">Ho...</th>
<th class="hidden-phone">Syst...</th>
<th class="hidden-phone">Area</th>
<th class="hidden-phone">Loc Name</th>
<th class="hidden-phone">Loc Unit</th>
</tr>
</thead>
<tbody>
<tr class="gradeX">
<td>65</td>
<td>01/17/2018 00:00:00</td>
<td>01/22/2018 00:00:00</td>
<td class="center hidden-phone">5</td>
<td class="center hidden-phone">0</td>
<td class="center hidden-phone">Mainline</td>
<td class="center hidden-phone">Kennedy Ave(WO01)</td>
<td class="center hidden-phone">Kennedy Ave</td>
<td class="center hidden-phone">Meter Loopline</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>Id</th>
<th>Planned Start Date</th>
<th>Planned End Date</th>
<th>D...</th>
<th class="hidden-phone">Ho...</th>
<th class="hidden-phone">Syst...</th>
<th class="hidden-phone">Area</th>
<th class="hidden-phone">Loc Name</th>
<th class="hidden-phone">Loc Unit</th>
</tr>
</tfoot>
</table>
</div>
</div>
</section>
计划停运
身份证件
计划开始日期
计划结束日期
D
呵。。。
系统。。。
地区
Loc名称
Loc单元
65
01/17/2018 00:00:00
01/22/2018 00:00:00
5.
0
主线
坚尼地道(WO01)
肯尼迪大道
仪表环路
身份证件
计划开始日期
计划结束日期
D
呵。。。
系统。。。
地区
Loc名称
Loc单元
图片:-
我不熟悉数据表,但也许你没有写“scrollY”对吧 看看:
var-oTable=$(“#示例”).DataTable({
sScrollY:200px,
initComplete:function(){
this.api().columns.adjust().draw()
}
})
sScrollY工作得很好,因为您的示例的数据表版本与我的不同。这就是语法不同的原因。scrollY
和sScrollY
完全相同scrollY
是>1.10.x命名约定,但仍然支持旧的选项名称。