filtering by column - exact value

filtering by column - exact value

justinmcunnjustinmcunn Posts: 4Questions: 0Answers: 0
edited April 2011 in General
I am trying to filter by columns. I am using the example here on the DataTables site to filter by using dropdown lists on the footer. (http://datatables.net/examples/api/multi_filter_select.html) However, when I try and filter based on say 'apple', 'apples' also appears in the list of data returned. I would like for all of the rows to be filtered out except for the rows that matches exactly 'apple'. Anyone have any ideas?

Replies

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    What you need to do in that case is make use of the regex abilities of the fnFilter API method ( http://datatables.net/api#fnFilter ). At the moment it is just doing sub-string matching, hence why it matches 'apples' for 'apple' - you want whole string matching - "^apple$" in regex. To do this turn off smart filtering and turn on regex when calling fnFilter.

    Allan
This discussion has been closed.