T
TanStack16mo ago
stormy-gold

Universal Table

Hey folks! I just started using tanstack-stable. I'm using Typescript and I have a database with tons of different tables, all of them have different column names and don't look like eachother. Will I be able to create a universal table that automatically adjusts to the parameters of the incoming GET/table request object? Or should I try using a different library for this? Thank you so much!
5 Replies
foreign-sapphire
foreign-sapphire16mo ago
I think most people do this in their codebase
stormy-gold
stormy-goldOP16mo ago
Do you have any examples of this? Would be really appreciated How would I approach this? I don't know the column names that will come in - but I want to be able to filter by them and sort them. Any thoughts? @KevinVandy
foreign-sapphire
foreign-sapphire16mo ago
all your asking for is making the columns dynamically based on data?
foreign-sapphire
foreign-sapphire16mo ago
Dynamic Columns with Material React Table Example
An example of Material React Table which shows how to fetch remote data and generate columns dynamically
foreign-sapphire
foreign-sapphire16mo ago
This just loops through the data keys in a row and creates columnDefs for it in useMemo or useState You have to be able to determine how different kinds of columns can be have depending on their data type though. Have some lookup function for specific columns that get generated all the time

Did you find this page helpful?