Disable ordering on multiple header rows

Disable ordering on multiple header rows

d1rtyd1rty Posts: 4Questions: 2Answers: 0

Hello!

I have added a 2nd row in the table header to have column-specifc filters. With Datatables 1, ordering was only applied to th elements, but this has changed with Datatables 2 where ordering is now applied to all table data elements (td and th) in the thead.

How can I disable the ordering on that first row?

Link to test case: https://jsfiddle.net/8qecu9jL/13/

Thank you!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin
    Answer ✓

    Add data-dt-order="disable" as an attribute to the row (or cell) that you don't want to be orderable (example here).

    And your own updated example.

    It is also possible to use orderCellsTops, although that isn't flexible enough to allow for all eventualities, hence the need for the attribute.

    Allan

  • d1rtyd1rty Posts: 4Questions: 2Answers: 0

    Thanks, that was exactly what I was looking for!

Sign In or Register to comment.