Skip to content

Commit

Permalink
Merge pull request #2207 from XiaoMi/hotfix/#2205
Browse files Browse the repository at this point in the history
fix(table): fix scrollWidth not work
  • Loading branch information
zyprepare authored Aug 16, 2022
2 parents 8fa7ddd + 1c298e4 commit 6a72072
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/ui/table/src/TableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const TableBody = forwardRef<HTMLDivElement | null, TableBodyProps>(
onTableBodyScroll,
maxHeight,
canScroll,
scrollWidth,
hasAvgColumn,
avgRow,
hasSumColumn,
Expand Down Expand Up @@ -69,7 +70,10 @@ export const TableBody = forwardRef<HTMLDivElement | null, TableBodyProps>(
overflowX: canScroll ? 'scroll' : undefined,
}}
>
<table ref={bodyTableRef} style={{ width: '100%' }}>
<table
ref={bodyTableRef}
style={{ width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%' }}
>
<colgroup>
{leafColumns.map((col: any, idx) => {
return (
Expand Down
1 change: 1 addition & 0 deletions packages/ui/table/src/use-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ export const useTable = ({

return {
rootProps,
scrollWidth,
activeSorterColumn,
setActiveSorterColumn,
activeSorterType,
Expand Down

0 comments on commit 6a72072

Please sign in to comment.