我正在使用 DataTables 1.9.4
桌子
<table border="0" cellpadding="0" cellspacing="0" class="display" id="example">
<thead>
<tr><th>Date</th><th>Discription</th><th>Amounts</th><th class="no-sort">Edit</th></tr>
</thead>
<tbody>
<tr class="no-sort"><td> </td><td>Starting money</td><td>$500</td><td>edit</td></tr>
<tr><td>2013-08-25</td><td>Payment out</td><td>-20</td><td>edit</td></tr>
<tr><td>2013-08-26</td><td>a Given money</td><td>-80</td><td>edit</td></tr>
<tr><td>2013-08-27</td><td>Fees taken</td><td>-100</td><td>edit</td></tr>
<tr class="no-sort"><td> </td><td>Balance</td><td>$300</td><td>edit</td></tr>
</tbody>
</table>
我试图让第一行和最后一行不排序,编辑列不使用此代码排序
$(document).ready(function() {
oTable = $('#example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 10,
"aaSorting": [[ 0, "asc" ]],
"oLanguage": {
"sZeroRecords": "No records to display"
}
});
var $tr = $('#example tr.no-sort');
var mySpecialRow = $tr.html();
var opts = {};
opts.fnDrawCallback = function(){
$('#example tbody').prepend(mySpecialRow);
};
});
但它仍然无法正常工作那些行正在排序,我已经搜索了任何可以帮助的地方,谢谢