0

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();
});
hmahdavi
  • 2,250
  • 3
  • 38
  • 90

1 Answers1

3

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
    ]
   });
});
gschambial
  • 1,383
  • 2
  • 11
  • 22
  • @programmer138200 You can check this. Let me know, if it works for you. – gschambial Oct 19 '16 at 09:33
  • OK. This worked.Now after load table rows display with out sorting. This is right but I want sort by columns after loading .Is this possible? – hmahdavi Oct 19 '16 at 09:36
  • @programmer138200 If i am getting you right. Initially, you want sorting disabled for empty table and when datatable is filled after pageload, you want to enable sorting again, right? – gschambial Oct 19 '16 at 09:40
  • I want after page load my table created with out sorting.I sort via the server side code. and I want sorting option enable for me – hmahdavi Oct 19 '16 at 09:44