TanStackT
TanStack2y ago
5 replies
sacred-rose

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!
Was this page helpful?