Skip to content

Commit 358d401

Browse files
committed
fix: pagination total
1 parent 68f8599 commit 358d401

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

packages/s2-core/src/facet/base-facet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ export abstract class BaseFacet {
11771177

11781178
const maxScrollY = Math.max(
11791179
0,
1180-
this.viewCellHeights.getTotalHeight() - this.panelBBox.height,
1180+
this.viewCellHeights.getTotalHeight() - this.panelBBox.viewportHeight,
11811181
);
11821182

11831183
if (scrollY > maxScrollY) {

packages/s2-react/src/components/sheets/base-sheet/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,10 @@ export const BaseSheet: React.FC<BaseSheetProps> = memo((props) => {
262262
if (!ownSpreadsheet) return;
263263
if (isFunction(reset)) reset();
264264
ownSpreadsheet.render(reloadData);
265-
setTotal(ownSpreadsheet.facet.viewCellHeights.getTotalLength());
265+
setTotal(
266+
options?.pagination?.total ??
267+
ownSpreadsheet.facet.viewCellHeights.getTotalLength(),
268+
);
266269
setLoading(false);
267270
};
268271

packages/s2-react/src/components/sheets/table-sheet/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ export const TableSheet: React.FC<BaseSheetProps> = memo((props) => {
157157
if (!ownSpreadsheet) return;
158158
if (isFunction(reset)) reset();
159159
ownSpreadsheet.render(reloadData);
160-
setTotal(ownSpreadsheet.facet.viewCellHeights.getTotalLength());
160+
setTotal(
161+
options?.pagination?.total ??
162+
ownSpreadsheet.facet.viewCellHeights.getTotalLength(),
163+
);
161164
setLoading(false);
162165
};
163166

0 commit comments

Comments
 (0)