T
TanStack2y ago
absent-sapphire

Group by row using shadcn tanstack table

I couldn't find any good docs or example to build this kind of table, can anyone please help me
No description
3 Replies
ugly-tan
ugly-tan2y ago
Just throwing out some ideas (from mobile, so excuse the lack of thoroughness): maybe using the column visibility API could be helpful? I would try something like: define all 4 columns (name,email,message,date) group by date (but depending on the format of the date in your data, make a getGroupingValue for that column like (date) => yearAndMonth(date) Then finally how to make the subrows not show the date. That is not something I've done, but I imagine using column visibility somehow could be useful
absent-sapphire
absent-sapphireOP2y ago
@Joel Can you show me via code if you can please ( I'm using the shadcn data table in nextjs )
ugly-tan
ugly-tan2y ago
Sorry, neither shadcn or next are part of my expertise. If you post the code you have maybe I can suggest where to make changes.

Did you find this page helpful?