From e9e68b6e40d61ca1ab687870a9ffed6b93b50d66 Mon Sep 17 00:00:00 2001 From: "Zhaoyuan (Ryan) Fu" Date: Fri, 17 Jan 2025 17:27:45 -0500 Subject: [PATCH] Fix issues around 'Show more' (#4909) --- src/shared/components/lazyMobXTable/LazyMobXTable.tsx | 9 +++++++-- .../components/paginationControls/PaginationControls.tsx | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/shared/components/lazyMobXTable/LazyMobXTable.tsx b/src/shared/components/lazyMobXTable/LazyMobXTable.tsx index 41fb799385b..c2ea7a44367 100644 --- a/src/shared/components/lazyMobXTable/LazyMobXTable.tsx +++ b/src/shared/components/lazyMobXTable/LazyMobXTable.tsx @@ -1129,6 +1129,8 @@ export default class LazyMobXTable extends React.Component< textBeforeButtons: this.store.paginationStatusText, groupButtons: false, bsStyle: 'primary', + isResultLimitedAtMaxPage: + this.props.isResultLimited && this.isAtMaxPage(), }; // override with given paginationProps if they exist if (this.props.paginationProps) { @@ -1326,14 +1328,17 @@ export default class LazyMobXTable extends React.Component< ); } + private isAtMaxPage() { + return this.store.maxPage > 0 && this.store.page === this.store.maxPage; + } + render() { return (
{this.getTopToolbar} {this.getTable} {this.props.isResultLimited && - this.store.maxPage > 0 && - this.store.page === this.store.maxPage && ( + (this.store.showingAllRows || this.isAtMaxPage()) && (
You've reached the maximum viewable records.{' '} diff --git a/src/shared/components/paginationControls/PaginationControls.tsx b/src/shared/components/paginationControls/PaginationControls.tsx index e445e7e576f..f5b4749e4dc 100644 --- a/src/shared/components/paginationControls/PaginationControls.tsx +++ b/src/shared/components/paginationControls/PaginationControls.tsx @@ -42,6 +42,7 @@ export interface IPaginationControlsProps { groupButtons?: boolean; hidePaginationIfOnePage?: boolean; bsStyle?: 'default' | 'primary' | 'success' | 'info' | 'warning'; + isResultLimitedAtMaxPage?: boolean; } @observer @@ -142,6 +143,7 @@ export class PaginationControls extends React.Component< id="showMoreButton" bsSize="sm" disabled={ + this.props.isResultLimitedAtMaxPage || !this.props.itemsPerPageOptions || !this.props.itemsPerPage || !this.props.totalItems ||