mirror of
https://github.com/rowyio/rowy.git
synced 2026-09-01 19:50:46 +02:00
support nested field parent label
This commit is contained in:
@@ -2,6 +2,7 @@ import { useLocation } from "react-router-dom";
|
||||
|
||||
import { ROUTES } from "@src/constants/routes";
|
||||
import { ColumnConfig, TableRow, TableRowRef } from "@src/types/table";
|
||||
import get from "lodash-es/get";
|
||||
|
||||
export const useSubTableData = (
|
||||
column: ColumnConfig,
|
||||
@@ -9,8 +10,8 @@ export const useSubTableData = (
|
||||
_rowy_ref: TableRowRef
|
||||
) => {
|
||||
const label = (column.config?.parentLabel ?? []).reduce((acc, curr) => {
|
||||
if (acc !== "") return `${acc} - ${row[curr]}`;
|
||||
else return row[curr];
|
||||
if (acc !== "") return `${acc} - ${get(row, curr)}`;
|
||||
else return get(row, curr);
|
||||
}, "");
|
||||
|
||||
const documentCount: string = row[column.fieldName]?.count ?? "";
|
||||
|
||||
Reference in New Issue
Block a user