I have a vue-good-table where I wanted to limit the columns a bit and made some composite columns, which consist of multiple properties of the row. The problem now is, the filterFn takes the column name to populate the data argument of the method. So I can only filter the one I decide to use as the column name. Is there a way to provide the whole row object to the filterFn like it is in the sortFn?
Template:
<template v-if="props.column.field === 'flags'">
<div v-if="props.row.isGlobal">Global</div>
<div v-if="props.row.isMobile">Mobile</div>
</template>
Column definition (I want to either show all rows where the Global or the Mobile flag is set):
{
label: 'Flags',
field: 'flags',
sortable: false,
filterOptions: {
enabled: true,
filterDropdownItems: ['Global', 'Mobile'],
filterFn: this.flagFilter,
},
},
Function (not working as data
is undefined):
public flagFilter(data, filterString) {
if ('Global' === filterString) {
return data.isGlobal;
} else if ('Mobile' === filterString) {
return data.isMobile;
}
return true;
}