Move the filter from the table footer to the top of the table?

Move the filter from the table footer to the top of the table?

MJJ79MJJ79 Posts: 10Questions: 4Answers: 0

Is it possible to move the column filters to the top the the table rather than it sitting at the bottom?
https://datatables.net/examples/api/multi_filter.html

Answers

  • kthorngrenkthorngren Posts: 22,458Questions: 26Answers: 5,166
    edited April 27

    Technically you can place the search inputs anywhere you like on the page. They don't need to be in the footer or header. Here is an example which places the search inputs in the second header row. The reason for two headers is to keep the table from sorting when clicking inside the search input. Setting orderCellsTop to true places the sort click events in just the top header row.

    This example also uses table().header() and column().search().

    The forum has other examples/solutions of placing search inputs in the header.

    Kevin

  • allanallan Posts: 65,712Questions: 1Answers: 10,928 Site admin

    Also worth having a look at ColumnControl which makes working with per-column search inputs much easier.

    Allan

  • MJJ79MJJ79 Posts: 10Questions: 4Answers: 0

    Thank you both for your replies. Both these solutions have helped me achieve what I need to.

Sign In or Register to comment.