How to combine individual column search box into a drop-down box?

How to combine individual column search box into a drop-down box?

bitcmasudbitcmasud Posts: 2Questions: 1Answers: 0

How to combine the individual column search box into a drop-down box so that user can select column head by selecting dropdown option and then put the keyword in search box? Drop-down box will only select column head so that search engine works among the column only by omitting other columns. The question is about the plugin https://datatables.net/examples/api/multi_filter.html

Answers

  • ThomDThomD Posts: 334Questions: 11Answers: 43

    I do not quite understand what you are asking. If you are asking how to use select boxes (aka drop down boxes) for column filters, check out this example.

    http://datatables.net/examples/api/multi_filter_select.html

  • bitcmasudbitcmasud Posts: 2Questions: 1Answers: 0

    Is it possible to have only one select box, which can select column head (Name, Position etc). This selection will not start search unless user input keyword in the search box.

  • ThomDThomD Posts: 334Questions: 11Answers: 43

    So you want to have a text box for search and then a select box so the user can pick which column the search will be applied to? That would have to be custom javascript, but not too hard. You need to build the select box so that the display value is the column name and the value is the column number. Use something like table().columns().each().header() I think to get the columns names.

    Then use that value as the selector in column().search() so that only that column gets searched

    Check out this page.
    http://datatables.net/reference/api/column().search()

This discussion has been closed.