I am really very new to dataTable and I just need one simple solution:
var initBasicTable = function() { var table = $('#basicTable'); var settings = { "sDom": "t", "sPaginationType": "bootstrap", "destroy": true, "paging": false, "scrollCollapse": true, "order": [[0,'desc']] }; table.dataTable(settings); $('#basicTable input[type=checkbox]').click(function() { if ($(this).is(':checked')) { $(this).closest('tr').addClass('selected'); } else { $(this).closest('tr').removeClass('selected'); } }); }
This works to sort the first column by default.
But I read that changing 0 in "order": [[0,'desc']] to a negative number will start sorting from the columns on the right. However, this:
var settings = { "sDom": "t", "sPaginationType": "bootstrap", "destroy": true, "paging": false, "scrollCollapse": true, "order": [[-1,'desc']] };
Throws an error, and I do not know where to continue.
I know that dataTable is really powerful and that, but, this is not what I was looking for, but a lot already
Nothing for "Sort by last (-1) column"? I felt lost. anyone?
source share