T
TanStackโ€ข13mo ago
deep-jade

Dynamic table with Shadcn + Tanstack Query + Tanstack Router

Hi everyone Anyone already did a dynamic table with Tanstack and Shadcn? I'm trying to build a hook to handle everything, filters, etc, but I'm facing some issues. If some one can share tips or suggestions of content please ๐Ÿ™
7 Replies
conscious-sapphire
conscious-sapphireโ€ข13mo ago
Shadcn docs has page for using TanStack table. https://ui.shadcn.com/docs/components/data-table
Data Table
Powerful table and datagrids built using TanStack Table.
deep-jade
deep-jadeOPโ€ข13mo ago
Yes I know, but I want to do something dynamic and using server they are using filters on the frontend
conscious-sapphire
conscious-sapphireโ€ข13mo ago
For server side filters use keys on TanStack Query. queryKey: ['key', {filter: ''}] That updates table data. You don't need anything extra.
deep-jade
deep-jadeOPโ€ข13mo ago
GitHub
tanstack-filtered-table-demo/src/hooks/useFilters.ts at main ยท Bala...
Managing table pagination, filtering and sorting on query parameters with the TanStack - Balastrong/tanstack-filtered-table-demo
deep-jade
deep-jadeOPโ€ข13mo ago
But the search give me this erro
No description
conscious-sapphire
conscious-sapphireโ€ข13mo ago
You don't need the table to set filters... If it's a server side call, change the url params. Include them as query keys. Track the params as state. Forget the client side helpers.
deep-jade
deep-jadeOPโ€ข13mo ago
Yes I know, but I'm trying to set the filters and the pagination on the url as query parameters but I have that error

Did you find this page helpful?