diff --git a/src/ColGroup.tsx b/src/ColGroup.tsx index a20e58c28..6c49f304f 100644 --- a/src/ColGroup.tsx +++ b/src/ColGroup.tsx @@ -22,7 +22,7 @@ function ColGroup({ colWidths, columns, columCount }: ColGroupProps< for (let i = len - 1; i >= 0; i -= 1) { const width = colWidths[i]; const column = columns && columns[i]; - let additionalProps; + let additionalProps: Record; let minWidth: number; if (column) { additionalProps = column[INTERNAL_COL_DEFINE]; diff --git a/src/FixedHolder/index.tsx b/src/FixedHolder/index.tsx index 86e739be1..09e4598b1 100644 --- a/src/FixedHolder/index.tsx +++ b/src/FixedHolder/index.tsx @@ -139,7 +139,13 @@ const FixedHolder = React.forwardRef>((pro const colGroupNode = useMemo(() => { // use original ColGroup if no data or no calculated column width, otherwise use calculated column width - if (noData || !mergedColumnWidth) { + // Return original colGroup if no data, or mergedColumnWidth is empty, or all widths are falsy + if ( + noData || + !mergedColumnWidth || + mergedColumnWidth.length === 0 || + mergedColumnWidth.every(width => !width) + ) { return colGroup; } return ( @@ -149,7 +155,14 @@ const FixedHolder = React.forwardRef>((pro columns={flattenColumnsWithScrollbar} /> ); - }, [noData, mergedColumnWidth, colGroup, combinationScrollBarSize, columCount, flattenColumnsWithScrollbar]); + }, [ + noData, + mergedColumnWidth, + colGroup, + combinationScrollBarSize, + columCount, + flattenColumnsWithScrollbar, + ]); return (
- - - - - - +