From 3d2e1b0ddfa210fa4d45ed259d62eec7bc1631af Mon Sep 17 00:00:00 2001 From: Mattias Andersson Date: Wed, 28 Aug 2024 15:15:32 +0200 Subject: [PATCH] - Add renderExtraHeadRows prop to StandardTable, allows one or several extra th rows in header, below ordinary header. --- .../components/StandardTable.tsx | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/grid/src/features/standard-table/components/StandardTable.tsx b/packages/grid/src/features/standard-table/components/StandardTable.tsx index b10fbc781..077ee38f3 100644 --- a/packages/grid/src/features/standard-table/components/StandardTable.tsx +++ b/packages/grid/src/features/standard-table/components/StandardTable.tsx @@ -141,17 +141,25 @@ export interface StandardTableProps< onSortOrderChange?: StandardTableOnSortOrderChange; /** - * If set, this will always show below and above first . - * This row is 100% custom, and inherits no design or functionality from StandardTable. - * You must make sure that extraHeaderRow root is a and contains elements. + * If set, this will always show inside , below last . + * This row is 100% custom, shown as is, and inherits no design or functionality from StandardTable. + * You must make sure that renderExtraHeadRows root is one or several elements. + * You must also make sure that it has correct number of cells, with correct padding, etc. + */ + renderExtraHeadRows?: () => ReactNode; + + /** + * If set, this will always show inside , above first . + * This row is 100% custom, shown as is, and inherits no design or functionality from StandardTable. + * You must make sure that extraHeaderRow root is a . * You must also make sure that it has correct number of cells, with correct padding, etc. */ renderExtraRowTop?: () => ReactNode; /** * If set, this will always show below last . - * This row is 100% custom, and inherits no design or functionality from StandardTable. - * You must make sure that extraHeaderRow root is a and contains elements. + * This row is 100% custom, shown as is, and inherits no design or functionality from StandardTable. + * You must make sure that extraHeaderRow root is a . * You must also make sure that it has correct number of cells, with correct padding, etc. */ renderExtraRowBottom?: () => ReactNode; @@ -175,6 +183,7 @@ export const StandardTable = function StandardTable< variant = "standard", onKeyDown, onSortOrderChange, + renderExtraHeadRows, ...props }: StandardTableProps) { const generatedTableId = useId(); @@ -313,6 +322,7 @@ export const StandardTable = function StandardTable< items={props.items} height={"var(--current-row-height)"} /> + {renderExtraHeadRows?.()}