您好,我想在数据表中添加行选择复选框,还需要针对每一行添加复选框。这样它将能够单独选择行。
谢谢。
您好,我想在数据表中添加行选择复选框,还需要针对每一行添加复选框。这样它将能够单独选择行。
谢谢。
$(document).ready(function() {
$('#example').DataTable( {
columnDefs: [ {
orderable: false,
className: 'select-checkbox',
targets: 0
} ],
select: {
style: 'os',
selector: 'td:first-child'
},
order: [[ 1, 'asc' ]]
} );
} );
HTML
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Salary</th>
</tr>
</thead>
<tr>
<td></td>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>$320,800</td>
</tr>
</table>
row.add([])
,它不会添加复选框。 - Zac Grierson