I'm using DataTables plugin. I don't want to use the sorting option (to sort the columns in ASC or DESC order) which comes by default on each <thead>
. How can I remove that sorting icon?
The ability to order data can be disabled using this option. Note that the ability to add or remove sorting of individual columns can be disabled by the columns. orderable option for each column. This parameter is a global option - when disabled, there are no sorting actions applied by DataTables at all.
The existing answers are using legacy DataTables syntax. Versions 1.10+ should use the following syntax: $('table'). dataTable({ "pageLength": -1, //display all records "order": [[ 0, "desc" ]] // Sort by first column descending });
The aaSorting parameter is an array of arrays where the first value is the column to sort on, and the second is 'asc' or 'desc' as required (it is a double array for multi-column sorting).
In the new version 1.10 of jQuery DataTables you must use ordering
option to disable ordering on the entire table:
$('#example').DataTable({ "ordering": false });
Very similar to @ravisolanki07 , it's just a different way to achieve this.
var oTable = $('#example').dataTable( { "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0, 1, 2, 3 ] }, { "bSearchable": false, "aTargets": [ 0, 1, 2, 3 ] } ] });
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