According to the Vuetify docs for custom filters in v-data-table, one can customize the filtering of a specific table column by supplying a filter property on header items.
In my application, I want to use this to customize filtering for a single column. For all other columns, I want to preserve the default string matching behavior.
As a jumping off point (see codepen), I have supplied a custom filter, that just returns true:
new Vue({
el: '#app',
vuetify: new Vuetify(),
data(){
return {
headers: [
{
text: 'Car Manufacturers',
value: 'car',
filter(){ return true }
},
{
text: 'Country of Origin',
value: 'country'
}
],
items: [
{ car: 'Honda', country: 'Japan' },
{ car: 'Audi', country: 'Germany' },
{ car: 'Ford', country: 'USA' }
],
search: ''
}
},
})
and
<div id="app">
<v-app>
<v-container>
<v-text-field
label="Search"
v-model="search"
>
</v-text-field>
<v-data-table
:headers="headers"
:items="items"
:search="search"
>
</v-data-table>
</v-container>
</v-app>
</div>
I would now have expected, that the filter on column car matches all rows and therefore the entire table is shown, no matter what search string I enter.
What I observe is, that the table is still filtered, but only by column country.
Conversely, when I change my filter to return false, an empty table is shown. I would then have expected, that the table is filtered only by column country.
How are the headers filters applied? Or, more precisely:
For each row, how are the results of the respective column filters combined to yield a filter result for the entire row?