Skip to content

fix: data preview table body overlapping the pagination bar#28

Merged
HTHou merged 1 commit into
apache:mainfrom
CritasWang:fix/data-table-height-overlap
Jul 2, 2026
Merged

fix: data preview table body overlapping the pagination bar#28
HTHou merged 1 commit into
apache:mainfrom
CritasWang:fix/data-table-height-overlap

Conversation

@CritasWang

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #27. On the Data Preview page the table body overflowed onto the bottom pagination bar (the rows and the "条/页" selector overlapped).

Root cause

The table hardcoded its virtual-scroll viewport height as `scroll.y = 480` (introduced in #24). #27 then added the timestamp-precision info banner above the table. In the flex layout, that extra banner reduced the space actually available to the table, but the fixed `480` didn't know about it — so the table body extended past its container and covered the pagination row below it.

The bug is the hardcoded constant: it silently breaks whenever anything is added above or below the table.

Fix

Measure the height instead of hardcoding it:

  • Wrap the table in a `flex-1 min-h-0` container and drive `scroll.y` from that container's real `clientHeight` via a `ResizeObserver`.
  • Subtract the measured table-header height (`.ant-table-header`) plus a small scrollbar/border reserve, so the body never covers the pagination.
  • Re-measure on `nextTick` after `loading`/data changes, since the column toolbar, info banner and pagination toggle their visibility once data arrives.
  • Make `.ant-card-body` a flex column so the wrapper's `flex-1` receives the real remaining height (antdv renders content inside `.ant-card-body`, and the `flex flex-col` on the Card root doesn't propagate there).

This adapts automatically to any elements added above/below the table in the future, rather than relying on another magic constant. Column pagination and row virtual-scrolling from #24/#27 are unchanged.

Also drops an unused `Spin` import.

Testing

  • `npm run build` (vue-tsc + vite) passes.
  • Verified in the browser: the table body now stops above the pagination bar; the bottom row and the "条/页" selector no longer overlap, and the height tracks the viewport / banner visibility on resize and data reload.

The data preview table hardcoded the virtual-scroll viewport height
(scroll.y = 480). After apache#27 added the timestamp-precision info banner
above the table, the fixed height no longer matched the actual space
left in the flex layout, so the table body overflowed onto the bottom
pagination bar.

Replace the hardcoded height with a measured one: wrap the table in a
flex-1 container and use a ResizeObserver to compute scroll.y from the
container's real client height, subtracting the measured header height
plus a scrollbar/border reserve. Re-measure after loading/data changes
(nextTick) since the column toolbar, info banner and pagination toggle
visibility. This adapts automatically to any future elements added
above or below the table instead of relying on a magic constant.

Also make .ant-card-body a flex column so the wrapper's flex-1 receives
the real remaining height, and drop an unused Spin import.
@HTHou
HTHou merged commit 7c8fe2f into apache:main Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants