hmahdavi
hmahdavi

Reputation: 2354

How to disable sorting in DataTables at the page load only?

I use this code for run DataTable on my table . This worked currently but I want run DataTable on my table with out sorting. Now my table sorted by column 0 .

How to do this?

$(document).ready(function(){
    $('#myTable').DataTable();
});

Upvotes: 0

Views: 2568

Answers (1)

gschambial
gschambial

Reputation: 1391

I think, you need something like this:

$(document).ready(function(){
    $('#myTable').DataTable({
    "bSort" :false
});
});

and if you wish to disable sorting column wise, You can use this:

 $(document).ready(function(){
   $('#myTable').DataTable( {
     "aoColumns": [
     { "bSortable": false },
     null,
    null,
    null
    ]
   });
});

Upvotes: 3

Related Questions