javascript - DataTables change default sort order - Stack Overflow

I use datatables with option serverSide: true. I see it in the ajax request body that it sends the defa

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
Add a ment  | 

2 Answers 2

Reset to default 3

In 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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744968829a4603843.html

相关推荐

  • javascript - DataTables change default sort order - Stack Overflow

    I use datatables with option serverSide: true. I see it in the ajax request body that it sends the defa

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信