fix subtable cell

This commit is contained in:
Shams mosowi
2020-08-21 17:39:34 +10:00
parent 69eaf321a4
commit a00eafce70
2 changed files with 7 additions and 5 deletions

View File

@@ -24,7 +24,8 @@ export type CustomCellProps = FormatterProps<any> & {
};
const getCellValue = (row, key) => {
return _get(row, key);
if (key.includes(".")) return _get(row, key);
return row[key];
};
/**
* HOC to wrap around custom cell formatters.
@@ -41,7 +42,6 @@ const withCustomCell = (Component: React.ComponentType<CustomCellProps>) => (
if (updateCell)
updateCell(props.row.ref, props.column.key as string, value);
};
return (
<ErrorBoundary fullScreen={false} basic>
<Suspense fallback={<div />}>

View File

@@ -126,14 +126,16 @@ export default function Table() {
const rowHeight = tableState.config.rowHeight;
const rows = tableState.rows;
//const rowGetter = (rowIdx: number) => rows[rowIdx];
const rowGetter = (rowIdx: number) =>
columns.reduce(
const rowGetter = (rowIdx: number) => ({
...rows[rowIdx],
...columns.reduce(
(acc, currColumn) => ({
...acc,
[currColumn.key]: _get(rows[rowIdx], currColumn.key),
}),
{}
);
),
});
// rows[rowIdx]