T
TanStack8mo ago
ratty-blush

Using TanStack tables in Astro

I'm new to TanStack. I'm looking into a tool to display a dataset as a list (not a table, just a <ul>). 1. Is TanStack dependant on a UI framework like React? Or can it be used in a vanilla js/ts project? 2. Do I need to initially display my entire dataset on a page before TanStack initializes and adds the pagination? 3. Does it also allow searching? And again, displaying the results using the previously chosen Sort method, and pagination.
4 Replies
optimistic-gold
optimistic-gold8mo ago
1. you can use tanstack table with no framework. Just install the table-core package 2. That question makes no sense to me. I'm going to say no 3. yes, that's one of the main reasons someone would choose tanstack table. For all of the client-side (or manual server-side) filtering and sorting features
ratty-blush
ratty-blushOP8mo ago
@KevinVandy Thanks for replying. With #2 I mean that some frameworks need to read the element that contains your dataset before they can initialize and transform it. For example, with such frameworks, I would need to display all the rows of my dataset and in a <script> tag target that element and initialize the framework. And then it would transform it into a table with all the usual features cause it will have the context of all the attributes of all the rows. Does that make sense? Take list.js for example: https://listjs.com/ the html containing all the data must exist on the page already. But I'm trying to avoid that cause it would slow down the pagespeed if the dataset is large.
optimistic-gold
optimistic-gold8mo ago
TanStack Table does not do that. That seems like the jQuery way of doing things lol TanStack Table is a state management library
ratty-blush
ratty-blushOP8mo ago
Gotcha 👍 thanks for answering my questions

Did you find this page helpful?