My Data-Tables Initialization Script is
$('#table').DataTable();
I want to disable auto sort of table column
Ok,i found the solution
just add data-order = ' ' in your table
<table class="table table-striped table-bordered " id="table" data-order=''>
Set the aaSorting option to an empty array. It will disable initial sorting,
"aaSorting": []
Example :
$('#you_table_id').DataTable({
"aaSorting": []
});
The aaSorting array should contain an array for each column to be sorted initially containing the column's index and a direction string (asc or desc).
// For updated version
$('#table').dataTable( {
"ordering": false
} );
// For older version
This is done by setting bSortable to false
$('#table').dataTable({
"bSortable": false
});
by aoColumnDefs
$('#table').dataTable( {
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] }
] } );
by aoColumns
$('#table').dataTable( {
"aoColumns": [
{ "bSortable": false },
null,
null,
null,
null
] } );
Disabling auto-sort with custom pagination icon using Font Awesome
$("#table").dataTable({
pagingType: "simple",
ordering: true,
autoWidth: true,
language: {
emptyTable: "No data available in table",
paginate: {
previous: '<i class="fa fa-chevron-left"></i>',
next: '<i class="fa fa-chevron-right"></i>',
},
search: "",
searchPlaceholder: "Search",
info: "_START_ - _END_ of _TOTAL_",
infoEmpty: "",
infoFiltered: "",
},
order: [] // Add this to Disable the auto-sorting
});
"bSortable": false, look this jsfiddle: jsfiddle.net/jhfrench/ptr63fxtorder: []...This maintain the order capabilities but does not set a default order, which is[[0, 'asc']]ordering the first column ascending.