Asim Sajjad
Asim Sajjad

Reputation: 116

Data table sorting issue (wants the default sorting not active when page loads first time)

I used datatables in my project. I want to disable the default sorting of datatable and the server side sorting to be executed when page loads first time. Every thing is fine, I has also given ("aaSorting": [],) empty as directed but still i am not getting the correct results. What I am missing, please help me!

Upvotes: 0

Views: 559

Answers (3)

Asim Sajjad
Asim Sajjad

Reputation: 116

Thanks for all your good efforts. I changed the looping condition and giving "aaSorting": [], in jquery ready function and all it works good.

Upvotes: 0

Tuhin
Tuhin

Reputation: 3373

use bSort property to enable or disable sorting feature

"bSort": false

for example

$(document).ready( function () {
      $('#example').dataTable( {
      "aaData": [
                ['Trident', 'Internet Explorer 4.0', 'Win 95+', 4, 'X'],
                ['Trident', 'Internet Explorer 5.0', 'Win 95+', 5, 'C'],
             ],
       "sPaginationType": "full_numbers", 
        "bSort": false,
        "bAutoWidth": false,
        "iDisplayLength": 20,

      } );
    } );

Upvotes: 2

Kaushal Khamar
Kaushal Khamar

Reputation: 2125

If you want that your data will not sort by datatable functionality then just disable sorting by this little code.

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

Upvotes: 0

Related Questions