admin管理员组文章数量:1405993
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
本文标签: javascriptDataTables change default sort orderStack Overflow
版权声明:本文标题:javascript - DataTables change default sort order - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744968828a2635110.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论