How to disable "sorting by nothing" of the third click on column header?

How to disable "sorting by nothing" of the third click on column header?

jstuardojstuardo Posts: 106Questions: 43Answers: 0
edited January 29 in Free community support

Hello. I don't know if this is possible to do, but in my case this causes a problem.

Normal behaviour about Datatable ordering is as follow.

  • First click on column header, sort ascending by that column
  • Second click on column header, sort descending by that column
  • Third click on column header, no sorting at all occur. If using server side processing, no order[0] element is posted to the server.

How can I avoid third click behaviour?

For instance, I need:

  • First click on column header, sort ascending by that column
  • Second click on column header, sort descending by that column
  • Third click on column header, sort ascending by that column
  • Fourth click on column header, sort descending by that column
  • And so on

Is that possible? Or maybe a workaround?

thanks
Jaime

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,680Questions: 26Answers: 5,019
    Answer ✓

    The columns.orderSequence docs have the answer. Use this to revert to the default Datatalbes 1.x behavior:

    DataTable.defaults.column.orderSequence = ['asc', 'desc'];
    

    Kevin

Sign In or Register to comment.