How can I use the order function to use the opposite order on clicking the TH element?
How can I use the order function to use the opposite order on clicking the TH element?
offir.peer
Posts: 9Questions: 4Answers: 0
I want to use the api to order the column by "desc" and "asc" when the user click on the TH element, is it possible using the api or should I do it manually?
$(".fixed-header th").on("click", function () {
var order = table.order();
table.order([$(this).data('sort'), oppositeOrder).draw();
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
DataTables should do that for you, but it it should be quite possible to use the API like you have. if that isn't working, please link to a test case showing the issue.
Allan