order: [[ 1, "desc" ]] not working
order: [[ 1, "desc" ]] not working
mitch2k
Posts: 3Questions: 2Answers: 0
Hi,
I'm trying to change the default ordening for my table like this:
// Basic ColVis example
$('.datatable-colvis-basic').DataTable({
colVis: {
buttonText: "<i class='icon-three-bars'></i> <span class='caret'></span>",
align: "right",
overlayFade: 200,
order: [[ 1, "desc" ]],
showAll: "Show all",
showNone: "Hide all"
}
});
I guess the "order: [[ 1, "desc" ]]," should force the table to sort on that column, but it doesn't. Am I missing something?
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Try:
Additionally, You should be using the Buttons extension now as Colvis is retired.
I'm not sure if you can call aaSorting from within Colvis, So try this if the above doesn't work:
Yes - the issue is that
order
is not a property of thecolVis
options. It is a top level option:See the
order
reference documentation for details and further examples.Allan
Thanks Allan, that was indeed the issue.