I'm trying to make a custom-filter to get only exact match
I want the filter to return opera if my search is opera but not :
- opera
- operation
- hope
an example of how to use custom filter : https://vuetifyjs.com/en/components/data-tables/#custom-filter
Currently what I have :
<v-data-table
:headers="headers"
:items="words"
item-key="name"
:search="search"
:custom-filter="filterPerfectMatch"
>
...
</v-data-table>
...
methods: {
filterPerfectMatch(value, search) {
return value != null &&
search != null &&
typeof value === 'string' &&
// value.match(search) === true && <== doesn't work T T
value.toString().indexOf(search) !== -1
},
},