Vue-good-table: filter by filterDropdownItems does partial match instead of exact match

Created on 27 Feb 2019  路  7Comments  路  Source: xaksis/vue-good-table

I use filterDropdownItems:

filterDropdownItems: [
{ value: 'inactive', text: 'Inactive' },
{ value: 'active', text: 'Active' },
{ value: 'check', text: 'Check' }
],

but when I select Active I see also rows with Inactive status. How can I change this behavior?

bug

Most helpful comment

You can use:

filterFn: function (data, filterString) {
  return data === filterString
}

All 7 comments

Here is a working example: https://jsfiddle.net/b90fa2er/1/

@unixconky ah thank you for the fiddle! so it seems like the filter is actually checking to see if the word includes the value... as opposed to an exact match. Legit bug, will have to look into it.

You can use:

filterFn: function (data, filterString) {
  return data === filterString
}

You can use:

filterFn: function (data, filterString) {
  return data === filterString
}

Nope, it doesn't work. filterFn is only used with standard text input, not filterDropdownItems.

I have updated to v 2.21.10 and this doesn't seem to work, if I have:
filterDropdownItems: ['STRING', 'STRING Additional 1', 'STRING Additional 2']
and if I select 'STRING' as the filter, all values are shown ('STRING' being a substring of the remaining two)...
_Note: I'm using mode="remote"_

You should try a previous version. #624 worked well back in the days.

And open a new issue, this one was for an old version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

enghelewa picture enghelewa  路  3Comments

unixconky picture unixconky  路  4Comments

hoanghiep1x0 picture hoanghiep1x0  路  5Comments

dylanvanes picture dylanvanes  路  3Comments

davidjr82 picture davidjr82  路  6Comments