I want to disable sorting for first row of my table, that row looks like
<tr class="no-sort">
<td colspan="4"></td>
<td></td>
<td></td>
<td></td>
</tr>
Don't add this row to the data dipslayed.
Add code to your fnDrawCallback
to add a row in your thead
, or at the beginning of your tbody
:
var opts = {};
opts.fnDrawCallback = function(){
var mySpecialRow = '<tr><td>First</td><td>Second</td></tr>';
$('#mytable thead').append(mySpecialRow);
// or
$('#mytable tbody').prepend(mySpecialRow);
}
$('#mytable').dataTable(opts);
Maybe I missed some details :
var $tr = $('#mytable tr.no-sort');
var mySpecialRow = $tr.html();
$tr.remove();
var opts = {};
opts.fnDrawCallback = function(){
$('#mytable thead').append(mySpecialRow);
// or
$('#mytable tbody').prepend(mySpecialRow);
};
// add any other option you want
opts.sPaginationType = "full_numbers";
$('#mytable').dataTable(opts);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With