Multi-row header: How to add Dropdown filters (SearchList) to specific columns ?

Multi-row header: How to add Dropdown filters (SearchList) to specific columns ?

Just1nJust1n Posts: 7Questions: 3Answers: 1

Hi everyone,

I am using DataTables with a multi-row header setup.

I want to place column filters in the second header row. I successfully managed to get text inputs working based on this example.

I need to display a Dropdown list (SearchList) instead of a text input, but only for specific columns. The other columns should keep the standard text input.

How can I modify the code to target specific columns in the second header row and inject a <select> element populated with the column's unique data?

Thanks for your help !

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 65,397Questions: 1Answers: 10,858 Site admin
    Answer ✓

    ColumnControl doesn't have a select option for search input at this time. It does however, have a -content searchList which is very similar (example here).

    Have a look at this example for how to have text input in some columns and the search list in others.

    It puts it into an icon, rather than into a second row in the header, but you could readily modify that for the text inputs if you want. The search list needs to be in a popover at the moment - it doesn't really work for display like the input element does I'm afraid.

    That is perhaps something that I can look into for a future release.

    Allan

Sign In or Register to comment.