How to disable sorting with jquery datatable
By FoxLearn 3/5/2025 6:32:55 AM 925
To disable sorting in a jQuery DataTable, you can use the ordering option in the DataTable initialization.
Setting ordering
to false
will prevent sorting functionality on the table.
$('#table').dataTable( { "ordering": false // Disable sorting } );
This will disable the sorting functionality for all columns in the table. If you want to disable sorting only on specific columns, you can use the columnDefs
option.
For example, disable sorting on specific columns (e.g., columns 0 and 1):
$(document).ready(function() { $('#example').DataTable({ "columnDefs": [ { "orderable": false, "targets": [0, 1] } // Disable sorting on column 0 and 1 ] }); });
This way, sorting will be disabled for the specified columns, but the rest of the table will still be sortable.
- How to add class to tr using jQuery datatable
- How to hide “Showing 1 of N Entries” with jQuery datatables
- How to Change parameter used in datatables ajax url.Action on Ajax.reload
- How to fix 'Requested unknown parameter '6' for row 0, column 6'
- How to Add new row to datatable using jquery datatable
- Ho to add class to column dynamically using jQuery datatable
- How to remove no data available in table from datatable in jQuery
- How to Rename “show XX entries” dropdown in DataTables
Categories
Popular Posts
11 Things You Didn't Know About Cloudflare
12/19/2024
AdminKit Bootstrap 5 HTML5 UI Kits Template
11/17/2024
Freedash bootstrap lite
11/13/2024
Modular Admin Template
11/14/2024