How to create a filter that filters the data instead of column
Hello I'm trying to have a filter that will filter data and not by column.
currently i have 2 filters, one is tied to the 'name' column while the other is tied to the dataset for the table.
5 Replies
fascinating-indigoOP•16mo ago
filter component:
fascinating-indigoOP•16mo ago


ratty-blush•16mo ago
what you are looking for is the
globalFilterFn
and globalFilter
. https://tanstack.com/table/latest/docs/api/features/global-filteringGlobal Filtering APIs | TanStack Table Docs
Can-Filter
The ability for a column to be globally filtered is determined by the following:
fascinating-indigoOP•16mo ago
I dont understand the documentation, also the examples i;ve found all have the datapoint they want to filter within the columns :/
when i use a filter for which i have a column there is no issue in filtering, but when i want to filter something by another datapoint from the dataset that is not displayed via column thats where i have issues.
also im working with a dataset of 900 objects, is there anything i can do regading this to have less of a delay when filtering/sorting?
ratty-blush•16mo ago
globalFilter is the value, I would assume this would be the filter string in your setup. globalFilterFn would be the function that takes
(row: Row, columnId: string, filterValue: string) => boolean
. You will need to control the value of globalFilter
to trigger the filtering of the table.
Remember that you will want to memoize all of these values before putting them into useReactTable if you are using react, not doing that could cause performance problems.