【发布时间】:2018-03-09 10:51:23
【问题描述】:
我正在使用响应式数据表 (https://www.datatables.net/extensions/responsive/examples/display-control/classes.html)。但展开/折叠图标出现在第一列值的左侧。
如何将其更改为显示在第一列值的右侧。
也想把图标样式改成使用Font Awesome的图标
JS:
$(document).ready( function () {
var table = $('#example').DataTable({
responsive: {
details: {
type: 'column'
}
},
columnDefs: [ {
className: 'control',
orderable: false,
targets: 0
} ],
order: [ 1, 'asc' ]
});
} );
HTML 代码:
<!DOCTYPE html>
<html>
<body>
<div class="container">
<table id="example" class="display responsive" width="100%">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td></td>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$3,120</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
【问题讨论】:
-
请提供一个与您遇到的问题重复的简单代码示例。
-
你的代码在哪里?
标签: javascript css datatable datatables