Skip to content

Commit 1e1b61e

Browse files
committed
fix virtualization toolbar bottom
1 parent 3af069a commit 1e1b61e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

client/packages/lowcoder/src/comps/comps/tableLiteComp/tableCompView.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export const TableCompView = React.memo((props: {
2222
const compName = useContext(CompNameContext);
2323
const [loading, setLoading] = useState(false);
2424
const tableContainerRef = useRef<HTMLDivElement>(null);
25+
const tableViewportRef = useRef<HTMLDivElement>(null);
26+
2527
const [containerHeight, setContainerHeight] = useState<number>(0);
2628

2729
const { comp, onDownload, onRefresh } = props;
@@ -69,18 +71,18 @@ export const TableCompView = React.memo((props: {
6971

7072
// Measure container height for virtualization
7173
useEffect(() => {
72-
if (!isFixedHeight || !tableContainerRef.current) return;
74+
if (!isFixedHeight || !tableViewportRef.current) return;
7375

7476
const measureHeight = () => {
75-
const el = tableContainerRef.current;
77+
const el = tableViewportRef.current;
7678
if (el) {
7779
// clientHeight = inner height available to the scrollable body
7880
setContainerHeight(el.clientHeight);
7981
}
8082
};
8183
measureHeight();
8284
const resizeObserver = new ResizeObserver(measureHeight);
83-
resizeObserver.observe(tableContainerRef.current);
85+
resizeObserver.observe(tableViewportRef.current);
8486

8587
return () => resizeObserver.disconnect();
8688
}, [isFixedHeight]);
@@ -194,7 +196,7 @@ export const TableCompView = React.memo((props: {
194196
return (
195197
<div ref={tableContainerRef} style={{ height: '100%', display: 'flex', flexDirection: 'column' }}>
196198
{toolbar.position === "above" && !hideToolbar && toolbarView}
197-
<div style={{ flex: 1, minHeight: 0 }}>
199+
<div ref={tableViewportRef} style={{ flex: 1, minHeight: 0 }}>
198200
<ResizeableTable<any>
199201
{...compChildren.selection.getView()(onEvent)}
200202
bordered={compChildren.showRowGridBorder.getView()}

0 commit comments

Comments
 (0)