Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/FixedHolder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro
const {
className,
style,
noData,
columns,
Comment thread
wanpan11 marked this conversation as resolved.
flattenColumns,
colWidths,
Expand Down Expand Up @@ -160,12 +159,14 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro
const mergedColumnWidth = useColumnWidth(colWidths, columCount);

const isColGroupEmpty = useMemo<boolean>(() => {
// use original ColGroup if no data or no calculated column width, otherwise use calculated column width
// Return original colGroup if no data, or mergedColumnWidth is empty, or all widths are falsy
// ColGroup should be rendered as long as column widths are available,
// even if there is no data. This maintains layout consistency between
// Header, Body, and Summary sections.
// Ref: https://github.com/ant-design/ant-design/issues/57916
const noWidth =
!mergedColumnWidth || !mergedColumnWidth.length || mergedColumnWidth.every(w => !w);
return noData || noWidth;
}, [noData, mergedColumnWidth]);
return noWidth;
}, [mergedColumnWidth]);
Comment thread
wanpan11 marked this conversation as resolved.

return (
<div
Expand Down
45 changes: 33 additions & 12 deletions tests/__snapshots__/FixedColumn.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2698,22 +2698,43 @@ exports[`Table.FixedColumn > renders correctly > scrollXY - without data 1`] = `
>
<colgroup>
<col
style="width: 100px;"
style="width: 1000px;"
/>
<col
style="width: 100px;"
style="width: 1000px;"
/>
<col />
<col />
<col />
<col />
<col />
<col />
<col />
<col />
<col />
<col
style="width: 100px;"
style="width: 1000px;"
/>
<col
style="width: 1000px;"
/>
<col
style="width: 1000px;"
/>
<col
style="width: 1000px;"
/>
<col
style="width: 1000px;"
/>
<col
style="width: 1000px;"
/>
<col
style="width: 1000px;"
/>
<col
style="width: 1000px;"
/>
<col
style="width: 1000px;"
/>
<col
style="width: 1000px;"
/>
<col
style="width: 15px;"
/>
</colgroup>
<thead
Expand Down
Loading