Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit a0f2a41

Browse files
authored
Merge pull request #969 from mnaoumov/issue-968
Integrate nestedKey into accessKey for reactTable
2 parents 5388538 + ed863e0 commit a0f2a41

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/Table.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,15 @@ export function Table(tableData: TableDataType) {
127127
}
128128

129129
const table: Table<RowDataType> = useReactTable({
130-
columns: columns,
130+
columns: columns.map(column => {
131+
if (!column.nestedKey) {
132+
return column;
133+
} else {
134+
const newColumn = Object.assign({}, column);
135+
newColumn.accessorKey = `${newColumn.accessorKey}.${newColumn.nestedKey}`;
136+
return newColumn;
137+
}
138+
}),
131139
data: rows,
132140
enableExpanding: true,
133141
getRowCanExpand: () => true,

0 commit comments

Comments
 (0)