aport002 aport002 - 5 months ago 9
jQuery Question

Disabling sorting in datatables not functioning

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

Try this:

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