dtTable = $("table.tablesorter").DataTable({
bDestroy: true,
bSort: false,
bFilter: false,
bLengthChange: true,
"aLengthMenu": [
[5, 15, 25, 50, -1],
[5, 15, 25, 50, "All"] // change per page values here
],
"iDisplayLength": recordsPerPage,
"sDom": "t<'row-fluid'<'m-wrap span3 customTableInfo'i><'m-wrap span4'p><'m-wrap span5 customTablePagingStyle'l>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sEmptyTable": "There are no records to display based on your filters.",
"sLengthMenu": "_MENU_ records per page",
"oPaginate": {
"sPrevious": "Prev",
"sNext": "Next"
}
},
});
I have this code to apply DataTable on each $("table.tablesorter")
in my project.
Now my client want to turn on the sorting. Additionaly he want to have new rows shown and few not.
Is there any way after turning bSort: true
i can add class to the column that turns sorting off for that column only?
Edit: You can disable by using the no-sort class on your ,
and use this initialization code:
// Disable sorting on the no-sort class
"aoColumnDefs" : [ {
"bSortable" : false,
"aTargets" : [ "no-sort" ]
} ]
I have a new question now.
When i apply sorting i the css background of the sorted <th>
is lost while for non-sorted remains same.
I want to retain the formating of the sorted columns.
Adding the below option do not work.
bSortClasses: false,
Edit 2:
I found that
table.table thead .sorting {
background: url('images/sort_both.png') no-repeat center right;
}
Is overriding my background-color defined here.
table-advance thead tr th {
background-color: #DDD;
font-size: 14px;
font-weight: bold;
color: #666;
}