假设我有如下表格: And I want to disable sorting of Action Column !--index.html-- table class="table table-striped table-bordered post-list-table" id="table" thead tr thTitle/th thCreated At/th thAction/th /tr /thead/table!--Script
And I want to disable sorting of Action Column
<!--index.html-->
<table class="table table-striped table-bordered post-list-table" id="table" >
<thead>
<tr>
<th>Title</th>
<th>Created At</th>
<th>Action</th>
</tr>
</thead>
</table>
<!--Script.js-->
$('#table').DataTable();
尝试添加:
columns.orderable
"columnDefs": [
{ "orderable": false, "targets": 2 }
]
JSFiddle Here
<!--Script.js-->
$('#table').DataTable( {
"columnDefs": [
{ "orderable": false, "targets": 2 }
]
});
<script src="http://img.558idc.com/uploadfile/allimg/210615/22450T613-0.jpg"></script>
<script src="http://img.558idc.com/uploadfile/allimg/210615/22450V304-1.jpg"></script>
<link href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" rel="stylesheet"/>
<table class="table table-striped table-bordered post-list-table" id="table" >
<thead>
<tr>
<th>Title</th>
<th>Created At</th>
<th>Action</th>
</tr>
</thead>
</table>
