Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 37f39e2

Browse files
author
Shammamah Hossain
committed
Allow for cases in which max_page_count is none/null.
1 parent 5cf474d commit 37f39e2

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/dash-table/components/ControlledTable/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -903,11 +903,11 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
903903
>
904904
</input>
905905

906-
{lastPage !== undefined ? ' / ' : ''}
906+
{lastPage ? ' / ' : ''}
907907

908-
<div className='last-page'>
909-
{lastPage !== undefined ? lastPage + 1 : ''}
910-
</div>
908+
{lastPage ? <div className='last-page'>
909+
{lastPage ? lastPage + 1 : ''}
910+
</div> : ''}
911911
</div>
912912

913913
<button
@@ -920,7 +920,7 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
920920
<button
921921
className='last-page'
922922
onClick={this.loadLast}
923-
disabled={this.props.page_current === lastPage || lastPage === undefined}>
923+
disabled={this.props.page_current === lastPage || !lastPage}>
924924
<FontAwesomeIcon icon='angle-double-right' />
925925
</button>
926926
</div>

src/dash-table/components/Table/Table.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ input.current-page, input.current-page::placeholder {
161161
color: black;
162162
border: none;
163163
width:30px;
164-
text-align:right;
164+
text-align:center;
165165
font-family: monospace;
166166
font-size: 10pt;
167167
margin: 0.5em;
@@ -170,6 +170,7 @@ input.current-page, input.current-page::placeholder {
170170
.page-number > .last-page {
171171
min-width: 30px;
172172
display: inline-block;
173+
text-align: center;
173174
margin: 0.5em;
174175
}
175176

src/dash-table/derived/paginator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function getBackEndPagination(
4444
setProps({ page_current, ...clearSelection });
4545
},
4646
loadLast: () => {
47-
if (max_page_count !== undefined) {
47+
if (max_page_count) {
4848
page_current = max_page_count;
4949
setProps({ page_current, ...clearSelection });
5050
}
@@ -66,7 +66,7 @@ function getBackEndPagination(
6666
return;
6767
}
6868

69-
if (max_page_count !== undefined && page > max_page_count) {
69+
if (max_page_count && page > max_page_count) {
7070
page_current = max_page_count;
7171
setProps({ page_current, ...clearSelection });
7272
return;

0 commit comments

Comments
 (0)