mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
make idAccessor configurable (#5599)
This commit is contained in:
parent
324d5929b5
commit
00e7cd1e26
@ -59,6 +59,7 @@ export type InvenTreeTableProps = {
|
|||||||
customFilters?: TableFilter[];
|
customFilters?: TableFilter[];
|
||||||
customActionGroups?: any[];
|
customActionGroups?: any[];
|
||||||
printingActions?: any[];
|
printingActions?: any[];
|
||||||
|
idAccessor?: string;
|
||||||
rowActions?: (record: any) => RowAction[];
|
rowActions?: (record: any) => RowAction[];
|
||||||
onRowClick?: (record: any, index: number, event: any) => void;
|
onRowClick?: (record: any, index: number, event: any) => void;
|
||||||
};
|
};
|
||||||
@ -81,6 +82,7 @@ const defaultInvenTreeTableProps: InvenTreeTableProps = {
|
|||||||
barcodeActions: [],
|
barcodeActions: [],
|
||||||
customFilters: [],
|
customFilters: [],
|
||||||
customActionGroups: [],
|
customActionGroups: [],
|
||||||
|
idAccessor: 'pk',
|
||||||
rowActions: (record: any) => [],
|
rowActions: (record: any) => [],
|
||||||
onRowClick: (record: any, index: number, event: any) => {}
|
onRowClick: (record: any, index: number, event: any) => {}
|
||||||
};
|
};
|
||||||
@ -486,7 +488,7 @@ export function InvenTreeTable({
|
|||||||
striped
|
striped
|
||||||
highlightOnHover
|
highlightOnHover
|
||||||
loaderVariant="dots"
|
loaderVariant="dots"
|
||||||
idAccessor={'pk'}
|
idAccessor={tableProps.idAccessor}
|
||||||
minHeight={200}
|
minHeight={200}
|
||||||
totalRecords={data?.count ?? data?.length ?? 0}
|
totalRecords={data?.count ?? data?.length ?? 0}
|
||||||
recordsPerPage={tableProps.pageSize ?? defaultPageSize}
|
recordsPerPage={tableProps.pageSize ?? defaultPageSize}
|
||||||
|
Loading…
Reference in New Issue
Block a user