Skip to content

Commit b289749

Browse files
Lukas742MarcusNotheis
authored andcommitted
fix(AnalyticalTable): Fixed resizable columns and horizontal scrolling (#211)
1 parent 2e1e339 commit b289749

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packages/main/src/components/AnalyticalTable/ColumnHeader/Resizer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const Resizer = (props) => {
1313
(e) => {
1414
e.stopPropagation();
1515
const pageX = e.pageX;
16-
const newWidth = Math.max(parentWidth.current + pageX - startX.current, column.minWidth);
16+
const newWidth = Math.round(Math.max(parentWidth.current + pageX - startX.current, column.minWidth));
1717
onColumnSizeChanged({
1818
column,
1919
width: newWidth

packages/main/src/components/AnalyticalTable/ColumnHeader/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const ColumnHeader: FC<ColumnHeaderProps> = (props) => {
132132
onGroupBy={onGroupBy}
133133
/>
134134
) : (
135-
openBy
135+
<div style={{ ...innerStyle, display: 'inline-block', cursor: 'auto' }}>{openBy}</div>
136136
)}
137137
{isResizable && <Resizer {...props} />}
138138
</div>

packages/main/src/components/AnalyticalTable/hooks/useWindowResize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const useWindowResize = () => {
66
const [tableWidth, setTableWidth] = useState(0);
77
const onWindowResize = useCallback(() => {
88
if (headerRef.current) {
9-
setTableWidth(headerRef.current.scrollWidth);
9+
setTableWidth(headerRef.current.getBoundingClientRect().width);
1010
}
1111
}, [setTableWidth, headerRef.current]);
1212

0 commit comments

Comments
 (0)