I use datatables with option serverSide: true
. I see it in the ajax request body that it sends the default ordering option, which is the first column and ASC always.
order[0][column]=0&order[0][dir]=asc
Is there a way to configure this and change default order setting?
I use datatables with option serverSide: true
. I see it in the ajax request body that it sends the default ordering option, which is the first column and ASC always.
order[0][column]=0&order[0][dir]=asc
Is there a way to configure this and change default order setting?
Share Improve this question edited Jul 11, 2019 at 11:22 Yevhen Horbunkov 15.6k3 gold badges27 silver badges45 bronze badges asked Jul 11, 2019 at 10:20 SpringSpring 11.9k30 gold badges121 silver badges192 bronze badges 3- 1 Have you checked out this page? – Yevhen Horbunkov Commented Jul 11, 2019 at 11:14
- @U25lYWt5IEJhc3RhcmQg works! I can accept if you answer the question – Spring Commented Jul 11, 2019 at 11:28
- 1 thanks, it is a kind of advice that isn't worth an answer – Yevhen Horbunkov Commented Jul 11, 2019 at 11:43
2 Answers
Reset to default 3In you DataTable Configuration inside javascript you can specify that with help of,
"order": [[1, "asc"]],
I hope this will help you! Thanks!
Solution is below in table settings:
{ ....
serverSide: true,
order: [ 4, 'desc' ]
ajax: { ...
More details on available options:
https://datatables/reference/option