T
TanStack•15mo ago
wise-white

How do I keep a group of rows permanently at the top?

Hey all, I'm making a table of transactions. Some transactions have the status "Pending" and I want to group all of those transactions at the front of the list. Ideally, all column sorts applied to the table would sort this pending group within itself and then all other transactions for the rest of the rows. Sorting doesn't seem like the right answer, because there are statuses before and after "Pending" in the alphabet. And filtering neither, because I want rows with all statuses to display, just the pending ones first. That led me to consider grouping, but I haven't figured out how to guarantee that Pending remains the group at the top, especially when other columns get sorted (the table appears to find the first item in the sort and bring its whole group to the top). Any tips on how to achieve what I'm looking for? Thanks for your time!
3 Replies
absent-sapphire
absent-sapphire•15mo ago
Row Pinning Guide | TanStack Table Docs
Examples Want to skip to the implementation? Check out these examples:
wise-white
wise-whiteOP•15mo ago
Amazing thank you! Checking that out now! There's a bug in the docs, they say that RowPinningState has optional top and bottom params that are booleans but really they're string arrays This worked though! Thank you!
absent-sapphire
absent-sapphire•15mo ago
If you can update the docs with a PR I’m sure everyone will appreciate it 🄹

Did you find this page helpful?