Skip to content

Commit

Permalink
fix: Expanded Rows with deep nesting example (#2500)
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-kallavus authored Nov 20, 2023
1 parent a40f501 commit 1203bd1
Show file tree
Hide file tree
Showing 2 changed files with 1,696 additions and 1,284 deletions.
20 changes: 16 additions & 4 deletions next-docs/public/examples/table/DeepTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,24 @@ const Example = () => {
{isAllRowsExpanded ? <ControlsChevronDown /> : <ControlsChevronRight />}
</span>
),
Cell: ({ row }: any) =>
row.canExpand ? (
<span style={{ paddingLeft: `${row.depth * 2}rem` }}>
Cell: ({ row, toggleRowExpanded }: any) =>
<div className="flex h-full items-center">
{row.canExpand ? (
<span
{...row.getToggleRowExpandedProps({
style: {
paddingLeft: `${row.depth * 2}rem`,
},
})}
onClick={(e) => {
e.preventDefault();
toggleRowExpanded(row.id, row.isExpanded !== true);
}}
>
{row.isExpanded ? <ControlsChevronDown /> : <ControlsChevronRight />}
</span>
) : null,
) : null}
</div>
},
{
Header: 'Name',
Expand Down
Loading

0 comments on commit 1203bd1

Please sign in to comment.