Skip to content

Row grouping in data-table #2809

Discussion options

You must be logged in to vote

So i've figured out a way to have a collapse in a row.

<TableBody>
  {table.getRowModel().rows?.length ? (
    table.getRowModel().rows.map((row) => (
      <Collapsible key={row.id} asChild>
        <>
          <CollapsibleTrigger asChild>
            <TableRow data-state={row.getIsSelected() && "selected"} className="!appearance-none">
              {row.getVisibleCells().map((cell) => (
                <TableCell key={cell.id}>
                  {flexRender(cell.column.columnDef.cell, cell.getContext())}
                </TableCell>
              ))}
            </TableRow>
          </CollapsibleTrigger>
          <CollapsibleContent asChild>
            <ExpandedContent dollars={[]} />

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@susilthapa
Comment options

@JuanPedroPontVerges
Comment options

@susilthapa
Comment options

@linaffilomania
Comment options

Answer selected by JuanPedroPontVerges
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants