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
Specify column names in columns option. Use columnDefs option to remove sorting from a column. Pass column index in targets within [] (Indexing starting from 0) and set orderable to false .
But if you want to disable ordering, search or visibility for specific column then you can use columnDefs. columnDefs provide to set parameter allows you to assign specific options to columns in data tables.
function destroy( [ remove ] )Restore the tables in the current context to its original state in the DOM by removing all of DataTables enhancements, alterations to the DOM structure of the table and event listeners.
FixedColumns provides the option to freeze one or more columns to the left or right of a horizontally scrolling DataTable. This allows information in the fixed columns to remain visible even when scrolling through the data set. This can be particularly useful if you wish to show a large number of columns.
Try this:
$(document).ready( function () {$('#example').dataTable( { "bSort": false } ); }
try this:
this is to disable initial sort
$(document).ready( function() { $('#example').dataTable({ "aaSorting": [] }); })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With