Is it possible to move the filtering outside the Table component? #2181
-
I would like to move the filtering to a parent component and use Table as a child. I saw that this is possible in react-table v6. Was wondering if the same is possible in react-table 7? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
Yes, I've done this in V7. Just let your |
Beta Was this translation helpful? Give feedback.
-
Alternatively, you can use imperative ref to control the table from outside (no need for state): With Provider (assuming 1 Table rendered): As a prop: |
Beta Was this translation helpful? Give feedback.
-
Is there an example for this using just setFilter? It's not clear to me how to filter (for example with a checkbox/toggle) from outside the table, but only filter on a single column. Ideas? |
Beta Was this translation helpful? Give feedback.
Yes, I've done this in V7. Just let your
Table
component listen out for changes on certain props and then callsetFilter
orsetGlobalFilter
at this point.