From 00e7cd1e26a95be819cebe522ed19ce84b7b01a4 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Sat, 23 Sep 2023 00:36:28 -0400 Subject: [PATCH] make idAccessor configurable (#5599) --- src/frontend/src/components/tables/InvenTreeTable.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/components/tables/InvenTreeTable.tsx b/src/frontend/src/components/tables/InvenTreeTable.tsx index cf04a888ba..4d2934d322 100644 --- a/src/frontend/src/components/tables/InvenTreeTable.tsx +++ b/src/frontend/src/components/tables/InvenTreeTable.tsx @@ -59,6 +59,7 @@ export type InvenTreeTableProps = { customFilters?: TableFilter[]; customActionGroups?: any[]; printingActions?: any[]; + idAccessor?: string; rowActions?: (record: any) => RowAction[]; onRowClick?: (record: any, index: number, event: any) => void; }; @@ -81,6 +82,7 @@ const defaultInvenTreeTableProps: InvenTreeTableProps = { barcodeActions: [], customFilters: [], customActionGroups: [], + idAccessor: 'pk', rowActions: (record: any) => [], onRowClick: (record: any, index: number, event: any) => {} }; @@ -486,7 +488,7 @@ export function InvenTreeTable({ striped highlightOnHover loaderVariant="dots" - idAccessor={'pk'} + idAccessor={tableProps.idAccessor} minHeight={200} totalRecords={data?.count ?? data?.length ?? 0} recordsPerPage={tableProps.pageSize ?? defaultPageSize}