Disabling sorting in datatables not functioning

aport002 picture aport002 · Dec 28, 2011 · Viewed 81.2k times · Source

Here is the code i am using

oTable = $('#example').dataTable({
                "bSort": false,
                "bStateSave":true,
                "aoColumns": [ 
                   { "bSortable": false },
                   { "bSortable": false },
                   { "bSortable": false } ] 
            });

The problem i'm having is that the table starts off blank and its populated by user input. Once the user starts to input things into the table, it sorts them by product ID. I'm trying to remove this sorting so that it just lists them as they are input.

EDIT: I have come to the conclusion that NONE of my initialization settings are working. I believe it has to do with the fnAddRow when the table is empty except for headers.

EDIT2: I've isolated it down to the fnAddData. When I initialize the table with trash data everything is formatted as its supposed to be but then once i use the fnAddData, it removes all formating

Answer

Alborz picture Alborz · Oct 17, 2012

Try this:

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