Skip to content

Remote Filtering & Sorting? #4371

Answered by JoeD101
JoeD101 asked this question in Ideas
Discussion options

You must be logged in to vote

I found a way to implement this. For the react-table side of things, I needed to use the filters and sortBy (arrays of key value pair objects which the key is the column name, and value is your filtering/descending or not value) that you can pass into state: in your createTable() function:

state: { pageIndex, pageSize, filters, sortBy }

From there, when you call your fetchData within the component of react-table with useEffect (just like documentation: https://react-table-v7.tanstack.com/docs/examples/pagination-controlled) you can add filters and sortBy to the dependency array of the useEffect call. It seems I have to have filter and sortBy states outside in the component where the fetc…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by JoeD101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
1 participant