Is there a way to make column filters(or dropdown search) outside of the table?

Is there a way to make column filters(or dropdown search) outside of the table?

solsol Posts: 18Questions: 7Answers: 0

Hi all,
I was wondering if I could make a function like column filter outside the table,
and if there is a way to make a drop-down filter for invisible columns!

I drew it for you to understand, so please refer to it.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited June 2023 Answer ✓

    This example here is adding column filters onto the table's footer.

    The code:

    .appendTo($(column.footer()).empty())
    

    is adding that new select element to the footer, but it could be placed anywhere in your DOM. That code is going through all columns, regardless of visibility, because of this loop:

                this.api()
                    .columns()
                    .every(function () {
    

    You could change that to be

                this.api()
                    .columns([6,7)
                    .every(function () {
    

    to just create the searches for your two columns.

    Colin

Sign In or Register to comment.