Closed reidsneo closed 3 years ago
Actually, it is the expected behaviour of the library. That's how sorting works.
If you want to keep sorting as it is on init, you should leave a blank array to "order" settings of datatables in javascript.
"order": []
I think it is the best way to set a default sorting order is setting "order" variable in javascript, and remove "order by" statements from sql, so php library can add the statement accordingly.
$(document).ready(function() {
$('#example').dataTable( {
"serverSide": true,
"ajax" : "/public/ajax.php",
"order" : [
[1, "asc"],
[2, "desc"]
]
});
});
Thank you!, it seem I missed the "order" part and "aaSorting" part, what I expect is the library will do the ordering part for init, but the js configuration mess it up, I will close the issue now thanks!
Dear Maintainer,
I have issue with multiple value order issue for example while using query like this :
SELECT * FROM ticket_table ORDER BY
status='Open' DESC,
status='In Progress' DESC,
status='On Hold' DESC, status
='Closed' DESC"`Which the result should be show on following order No Name Status 5 Blabla Open 2 Blabla Open 3 Blabla Open 6 Blabla In Progress 7 Blabla In Progress 1 Blabla On Hold 8 Blabla On Hold
but it displayed in normal squence instead, it seem in generate() method set a new index instead using as is as result from mysql
Thanks!