asSorting troubles
asSorting troubles
JohnDT
Posts: 2Questions: 0Answers: 0
Hello,
I'm having trouble with asSorting. When my table is rendered, the default sorting on the first column is still ascending. It's when I click on it that it changes to descending and then locks in and stays with descending. I'd like to load with descending by default. My code is below. If it makes any difference, I'm using the bootstrap styles. Thanks in advance.
[code]
$(document).ready(function() {
$('#procedures').dataTable({
"fnPreDrawCallback": function(oSettings, json) {
$('.dataTables_filter input').addClass('form-control');
$('.dataTables_filter input').css('width', '200px');
$('.dataTables_filter input').attr("placeholder", "Search");
},
"sDom": "<'row'<'col-sm-12'<'pull-left'f>>>rt<'row'<'col-sm-6'i><'col-sm-6'p>><'clear'>",
"aoColumnDefs": [
{"asSorting": ["desc"], "aTargets": [0]},
{"bSortable": false, "aTargets": [-1]},
{"bSearchable": false, "aTargets": [-1]}
],
"oLanguage": {
"sSearch": ""
}
});
});
[/code]
I'm having trouble with asSorting. When my table is rendered, the default sorting on the first column is still ascending. It's when I click on it that it changes to descending and then locks in and stays with descending. I'd like to load with descending by default. My code is below. If it makes any difference, I'm using the bootstrap styles. Thanks in advance.
[code]
$(document).ready(function() {
$('#procedures').dataTable({
"fnPreDrawCallback": function(oSettings, json) {
$('.dataTables_filter input').addClass('form-control');
$('.dataTables_filter input').css('width', '200px');
$('.dataTables_filter input').attr("placeholder", "Search");
},
"sDom": "<'row'<'col-sm-12'<'pull-left'f>>>rt<'row'<'col-sm-6'i><'col-sm-6'p>><'clear'>",
"aoColumnDefs": [
{"asSorting": ["desc"], "aTargets": [0]},
{"bSortable": false, "aTargets": [-1]},
{"bSearchable": false, "aTargets": [-1]}
],
"oLanguage": {
"sSearch": ""
}
});
});
[/code]
This discussion has been closed.
Replies
I know the documentation in this area isn't brilliant. I'm working on improving it!
Allan