How to have sort and select filters in different header rows?
How to have sort and select filters in different header rows?
I'm following the example found here - https://datatables.net/examples/api/multi_filter_select.html
We have two identical table header rows in the thead, wanting one for sort and one for filters.
We didn't want the select filters in the footer, so changed it to column.header() and tried using orderCellsTop, but what happens is both the sort and the filter are applied to the same row no matter what.
Any recommendations on how to apply the sort to the second table header?
This question has accepted answers - jump to:
Answers
https://jsfiddle.net/LLzajqtv/ here's a fiddle using the sample data as an example
Rather than using
column().header()
you need to use jQuery to address the second row. The DataTables API currently only allows the primary header cell for the column to be accessed through it.Allan
I think this fiddle achieves what I'm looking for. https://jsfiddle.net/wwhe7k20
Filter at top, sort on bottom.
Also wanted to remove some filters, so this fiddle shows how to do that for anyone in the same boat - https://jsfiddle.net/wwhe7k20/2/ - using not(":eq(2),:eq(3),:eq(4)") to remove specific columns
Great - thanks for posting up the fiddles for others :-)
Allan