Himanshu
Himanshu

Reputation: 1

Preventing data table default sorting

I want to prevent by default sorting in data table.

Below is the code I am using.

$('#tableId').dataTable( {
    "bPaginate": true,
    "stateSave": true                       
});

Upvotes: 0

Views: 98

Answers (2)

Himanshu
Himanshu

Reputation: 1

$('#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.

Upvotes: 0

webolive
webolive

Reputation: 121

Have you tried using this : columns.orderable ?

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

Upvotes: 1

Related Questions