【发布时间】:2019-09-21 09:40:17
【问题描述】:
我正在尝试使用水平滚动的数据表,其中前 2 列应该固定而不滚动
html代码如下
<table class="table display nowrap">
<thead>
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
<th>e</th>
<th>f</th>
<th>g</th>
<th>h</th>
<th>i</th>
</tr>
</thead>
<tbody>
<tr>
<td>a data</td>
<td>b data</td>
<td>c data</td>
<td>d data</td>
<td>e data</td>
<td>f data</td>
<td>g data</td>
<td>h data</td>
<td>i data</td>
</tr>
<tr>
<td>a data</td>
<td>b data</td>
<td>c data</td>
<td>d data</td>
<td>e data</td>
<td>f data</td>
<td>g data</td>
<td>h data</td>
<td>i data</td>
</tr>
</tbody>
</table>
jquery 代码是
$('.table').DataTable( {
"searching": false ,
"paging": false ,
fixedColumns: {
leftColumns: 1
},
scrollX: true,
});
所以当我使用数据表库运行这两个代码的组合时,结果如下
【问题讨论】:
标签: jquery datatable bootstrap-4