xaksis / vue-good-table

An easy to use powerful data table for vuejs with advanced customizations including sorting, column filtering, pagination, grouping etc
https://xaksis.github.io/vue-good-table/
MIT License
2.16k stars 405 forks source link

Enhance the filter function for columns #640

Open onyx-blackbird opened 5 years ago

onyx-blackbird commented 5 years ago

Issue Type

Expected Behavior

As an additional argument the whole row object should be available (function(data, filterString, row)), so you can write a more complex filter for composite columns. In my Case I have a "title" column, but there I also display a description and other information in the same column and I would like to filter for any string within this column.

Actual Behavior

The signature for the filter function is function(data, filterString) as described here: https://xaksis.github.io/vue-good-table/guide/configuration/column-filter-options.html#filterfn

onyx-blackbird commented 4 years ago

Just found the line of code where this could be added within filterRows of Table.vue:

return col.filterOptions.filterFn(
    this.collect(row, col.field),
    this.columnFilters[col.field],
    row //just add this
);