Search/Filter not working with select input in field

Search/Filter not working with select input in field

vg10vg10 Posts: 11Questions: 3Answers: 1
edited June 2017 in Free community support

I have a drop-down list in one of my DataTables columns, and the search field will return all rows regardless of which item in the drop-down is selected. For example, if my select contains "Orange", "Apple", "Pear" and I enter "app" into the search, all records are returned even ones where the selected value is "Pear". I dug into the code a bit and appears the searchable data that is built includes the entire <select>...</> with all the options, so of course it finds "app" every time. I have set that column to have a "type":"html" in the options in case that makes a difference and it does not.

I have searched the forums and examples but don't see any way to fix this. I have seen similar questions that all reference this as an answer: https://datatables.net/examples/api/multi_filter_select.html , however that does not address the situation of the drop-down being inside the table that should be searched against, so I don't understand how the referenced page would help in this situation. Can someone please help?

p.s. Not sure if I should be calling this "search" or "filter" - seems to be used interchangably in documentation. I'm referring to the search textbox which our company has relabeled as "Filter"

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    @vg10 - This is a question for a good while ago. I missed it at the time, apologies!

    Is it something that is still causing a problem for you?

    Not sure if I should be calling this "search" or "filter" - seems to be used interchangably in documentation. I'm referring to the search textbox which our company has relabeled as "Filter"

    It should be called "search". It did used to be called filter, which is why the documentation is a little mixed up - but with the introduction of the filter() helper method in 1.10 I wanted to try and use the terminology "search" only.

    Allan

  • vg10vg10 Posts: 11Questions: 3Answers: 1
    Answer ✓

    Hi Allan, actually I think I posted this question shortly before we decided to purchase Datatables Editor, so we no longer have this scenario in a plain DataTables instance. I don't know if this would still be an issue if we did, but since we're successfully using Editor instead, we no longer need it. You can probably close this question. Thanks for looping back around!

This discussion has been closed.