0

I want to prevent by default sorting in data table.

Below is the code I am using.

$('#tableId').dataTable( {
    "bPaginate": true,
    "stateSave": true                       
});
freedomn-m
  • 27,664
  • 8
  • 35
  • 57
Himanshu
  • 1
  • 4
  • 1
    Does this answer your question? [Is there a way to disable initial sorting for jquery DataTables?](https://stackoverflow.com/questions/4964388/is-there-a-way-to-disable-initial-sorting-for-jquery-datatables) –  Jun 05 '20 at 11:10
  • i tried this but it did't work for me. – Himanshu Jun 05 '20 at 11:15

2 Answers2

1

Have you tried using this : columns.orderable ?

$('#tableId').dataTable( {
    "bPaginate": true,
    "stateSave": true,
    "columnDefs": [{ "orderable": false, "targets": '_all' }]                     
});
webolive
  • 121
  • 3
0
$('#tableId').dataTable( {
  "bPaginate": true,
  "columnDefs": [{ "orderable": false, "targets": '_all' }] 
});

Actually it save the state of previous one , after removing state save property its working fine.

Himanshu
  • 1
  • 4