diff --git a/src/Body/BodyRow.tsx b/src/Body/BodyRow.tsx index 5f307cad6..6c2786768 100644 --- a/src/Body/BodyRow.tsx +++ b/src/Body/BodyRow.tsx @@ -196,6 +196,7 @@ function BodyRow( component={RowComponent} cellComponent={cellComponent} colSpan={flattenColumns.length} + isEmpty={false} > {expandContent} diff --git a/src/Body/ExpandedRow.tsx b/src/Body/ExpandedRow.tsx index b3203e8b3..e10399a2f 100644 --- a/src/Body/ExpandedRow.tsx +++ b/src/Body/ExpandedRow.tsx @@ -12,6 +12,7 @@ export interface ExpandedRowProps { expanded: boolean; children: React.ReactNode; colSpan: number; + isEmpty: boolean; } function ExpandedRow({ @@ -22,15 +23,17 @@ function ExpandedRow({ className, expanded, colSpan, + isEmpty, }: ExpandedRowProps) { const { scrollbarSize } = React.useContext(TableContext); - const { fixHeader, fixColumn, componentWidth } = React.useContext(ExpandedRowContext); + const { fixHeader, fixColumn, componentWidth, horizonScroll } = + React.useContext(ExpandedRowContext); // Cache render node return React.useMemo(() => { let contentNode = children; - if (fixColumn) { + if (isEmpty ? horizonScroll : fixColumn) { contentNode = (
({ component={trComponent} cellComponent={tdComponent} colSpan={flattenColumns.length} + isEmpty > {emptyNode} diff --git a/src/Table.tsx b/src/Table.tsx index 6ab97093f..61412de41 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -844,8 +844,9 @@ function Table(props: TableProps ({ onColumnResize }), [onColumnResize]); diff --git a/src/context/ExpandedRowContext.tsx b/src/context/ExpandedRowContext.tsx index 70d46fb20..bbc5eccc0 100644 --- a/src/context/ExpandedRowContext.tsx +++ b/src/context/ExpandedRowContext.tsx @@ -4,6 +4,7 @@ export interface ExpandedRowProps { componentWidth: number; fixHeader: boolean; fixColumn: boolean; + horizonScroll: boolean; } const ExpandedRowContext = React.createContext(null);