Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions semcore/data-table/src/components/Body/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,33 @@ class BodyRoot<Data extends DataTableData, UniqKeyType> extends Component<DataTa
};
}

getSpinnerTopOffset = () => {
const { headerHeight: propsHeaderHeight, tableContainerRef, stickyHeader } = this.asProps;

let headerHeight = propsHeaderHeight;

if (stickyHeader) {
return headerHeight;
}

if (tableContainerRef.current) {
if (tableContainerRef.current.scrollTop > headerHeight) {
headerHeight = 0;
} else {
headerHeight = headerHeight - tableContainerRef.current.scrollTop;
}
}

return headerHeight;
};

render() {
const SBody = Root;
const SRowGroup = Box;
const SSpinContainer = Box;
const {
styles,
loading,
headerHeight,
spinnerRef,
virtualScroll,
scrollDirection,
Expand All @@ -169,8 +188,6 @@ class BodyRoot<Data extends DataTableData, UniqKeyType> extends Component<DataTa
} = this.asProps;

let rowsToRender = rows;
// let startIndex = -1;
// let lastIndex = -1;

if (virtualScroll) {
const rowsBuffer =
Expand Down Expand Up @@ -335,7 +352,7 @@ class BodyRoot<Data extends DataTableData, UniqKeyType> extends Component<DataTa
<SSpinContainer
innerOutline
// @ts-ignore
headerHeight={`${headerHeight}px`}
headerHeight={`${this.getSpinnerTopOffset()}px`}
tabIndex={-1}
ref={spinnerRef}
role='row'
Expand Down
Loading