I'm really really 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 is working, for sorting the first column by default.
But I read that changing the 0
in "order": [[0,'desc']]
into negative number will begin 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 have no idea where to continue.
I know dataTable is really powerful and that but, this is no what I was looking for but plenty already
Nothing for 'Sort by last(-1) column'? I felt lost. anyone?