Skip to content

Commit

Permalink
Fix issues around 'Show more'
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzhaoyuan authored and alisman committed Jan 17, 2025
1 parent 8fce8f8 commit 1930934
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/shared/components/lazyMobXTable/LazyMobXTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,8 @@ export default class LazyMobXTable<T> 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) {
Expand Down Expand Up @@ -1326,14 +1328,17 @@ export default class LazyMobXTable<T> extends React.Component<
);
}

private isAtMaxPage() {
return this.store.maxPage > 0 && this.store.page === this.store.maxPage;
}

render() {
return (
<div className="lazy-mobx-table" data-test="LazyMobXTable">
<Observer>{this.getTopToolbar}</Observer>
<Observer>{this.getTable}</Observer>
{this.props.isResultLimited &&
this.store.maxPage > 0 &&
this.store.page === this.store.maxPage && (
(this.store.showingAllRows || this.isAtMaxPage()) && (
<div className={'text-center alert alert-info'}>
<strong>
You've reached the maximum viewable records.{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface IPaginationControlsProps {
groupButtons?: boolean;
hidePaginationIfOnePage?: boolean;
bsStyle?: 'default' | 'primary' | 'success' | 'info' | 'warning';
isResultLimitedAtMaxPage?: boolean;
}

@observer
Expand Down Expand Up @@ -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 ||
Expand Down

0 comments on commit 1930934

Please sign in to comment.