fix: column width issue with scroll.y when table has no data (#5256)

This commit is contained in:
Katherine 2024-09-14 15:39:18 +08:00 committed by GitHub
parent 961e14bcef
commit ab719cf960
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -714,9 +714,9 @@ export const Table: any = withDynamicSchemaProps(
const scroll = useMemo(() => {
return {
x: 'max-content',
y: tableHeight,
y: dataSource.length > 0 ? tableHeight : undefined,
};
}, [tableHeight, maxContent]);
}, [tableHeight, maxContent, dataSource]);
const rowClassName = useCallback(
(record) => (selectedRow.includes(record[rowKey]) ? highlightRow : ''),
@ -754,6 +754,9 @@ export const Table: any = withDynamicSchemaProps(
height: 100%;
display: flex;
flex-direction: column;
.ant-table-expanded-row-fixed {
min-height: ${tableHeight}px;
}
.ant-table-body {
min-height: ${tableHeight}px;
}