Column search dropdown outside of table?

Column search dropdown outside of table?

DavidnyDavidny Posts: 2Questions: 1Answers: 0

I am looking at this: https://datatables.net/examples/api/multi_filter_select.html

The problem is I really only need the drop-down for one of my columns, not all of them. How can I modify the jquery to just have one drop-down for, say, column #3. I would also like it to not be in the footer or the header, but in a

<

div> that floats above the table. Possible?

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Line 4 has:

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

    so it's iterating through the columns. Remove that loop and change line 8 to be var column = this.api().column(3).

    Line 7 has:

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

    change that to be column().header().

    Colin

  • DavidnyDavidny Posts: 2Questions: 1Answers: 0

    Thank you for single-column solution, is there a solution for putting it outside of the table and not part of the header?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Yep, line 7 has an appendTo() call - you can append it to anything.

This discussion has been closed.