T
TanStack3y ago
rare-sapphire

React-table multi filter

Hi everyone. How can I filter a column by multiple values instead of just one as setFilterValue does?
6 Replies
rare-sapphire
rare-sapphireOP3y ago
Why can't you send different values to an array with the same key? It would be logical to send something like this setColumnFilters([{id: "firstName", value: "Alex"}, {id: "firstName", value: "Egor"},]) or setColumnFilters([{id: "firstName", value: ["Alex", "Egor"]}]) Help me, guys
ambitious-aqua
ambitious-aqua3y ago
use filters for same key i think no have sense, the filter are working with "and" operator, not "or" then it is impossible to have value1 == A AND value2 ==B
rare-sapphire
rare-sapphireOP3y ago
but i need to use it for one key. For example, apply values to a column to display the results of three values out of five, for example
ambitious-aqua
ambitious-aqua3y ago
i'm not sure if that is possible, on my similar case i used a grouped system
unwilling-turquoise
unwilling-turquoise3y ago
Wait we can't filter on the same key with multiple values? For example, if a tasks table had multiple statuses like "To do", "In Progress" and "Completed", I wouldn't be able to filter only for all the "To do" and "In Progress" tasks?
rare-sapphire
rare-sapphireOP3y ago
I had to create a filter on top of the tbody component with my own function. And if string checking is used somewhere at the moment using multifiltering, I use this function I didn't find another way. It is very strange why they could not implement this filtering in this table initially it is possible to filter the same key, but only two values, through the and operator. But if there are more than two manifestations, then nothing, only custom density

Did you find this page helpful?