T
TanStack•3y ago
blank-aquamarine

globalFilter that can apply to specific columns

Hi there! I have a feature where I can have the global filter apply to all columns, or narrow it down to specific columns. Was wondering what the best approach would be for implementing this? For example, if I had this table:
| firstName | lastName | Id |
| john | taylor | 1 |
| taylor | green | 2 |
| firstName | lastName | Id |
| john | taylor | 1 |
| taylor | green | 2 |
if I searched by default for "Taylor", I'd expect 2 rows returned. But if I narrow it to the firstName column and set a global search for "Taylor", I'd expect just a single row returned. Thanks for any help you can provide 🙂
2 Replies
blank-aquamarine
blank-aquamarineOP•3y ago
I was thinking that this might be helpful but wondering if anyone has solved this in a different way: https://tanstack.com/table/v8/docs/api/features/filters#getcolumncanglobalfilter
Filters | TanStack Table Docs
Can-Filter The ability for a column to be column filtered is determined by the following:
blank-aquamarine
blank-aquamarineOP•3y ago
I think the problem with this approach is changing getColumnCanGlobalFilter doesn't cause the table to recalculate the filtered rows 😦

Did you find this page helpful?