Skip to content

Commit 2da1b85

Browse files
committed
fix #1046
1 parent fafc080 commit 2da1b85

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/BootstrapTable.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,7 @@ class BootstrapTable extends Component {
10131013
lastPageTitle={ options.lastPageTitle || Const.LAST_PAGE_TITLE }
10141014
hideSizePerPage={ options.hideSizePerPage }
10151015
sizePerPageDropDown={ options.sizePerPageDropDown }
1016+
hidePageListOnlyOnePage={ options.hidePageListOnlyOnePage }
10161017
paginationPanel={ options.paginationPanel }
10171018
open={ false }/>
10181019
</div>
@@ -1325,6 +1326,7 @@ BootstrapTable.propTypes = {
13251326
Const.PAGINATION_POS_BOTH
13261327
]),
13271328
hideSizePerPage: PropTypes.bool,
1329+
hidePageListOnlyOnePage: PropTypes.bool,
13281330
alwaysShowAllBtns: PropTypes.bool,
13291331
withFirstAndLast: PropTypes.bool,
13301332
onSortChange: PropTypes.func,
@@ -1472,6 +1474,7 @@ BootstrapTable.defaultProps = {
14721474
paginationSize: Const.PAGINATION_SIZE,
14731475
paginationPosition: Const.PAGINATION_POS_BOTTOM,
14741476
hideSizePerPage: false,
1477+
hidePageListOnlyOnePage: false,
14751478
alwaysShowAllBtns: false,
14761479
withFirstAndLast: true,
14771480
onSizePerPageList: undefined,

src/pagination/PaginationList.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class PaginationList extends Component {
7575
sizePerPageList,
7676
paginationShowsTotal,
7777
pageStartIndex,
78-
paginationPanel
78+
paginationPanel,
79+
hidePageListOnlyOnePage
7980
} = this.props;
8081
this.totalPages = Math.ceil(dataSize / sizePerPage);
8182
this.lastPage = this.props.pageStartIndex + this.totalPages - 1;
@@ -110,6 +111,7 @@ class PaginationList extends Component {
110111
}
111112
});
112113

114+
const hidePageList = hidePageListOnlyOnePage && this.totalPages === 1 ? 'none' : 'block';
113115
return (
114116
<div className='row' style={ { marginTop: 15 } }>
115117
{
@@ -118,7 +120,8 @@ class PaginationList extends Component {
118120
<div className='col-md-6 col-xs-6 col-sm-6 col-lg-6'>
119121
{ total }{ sizePerPageList.length > 1 ? dropdown : null }
120122
</div>
121-
<div className='col-md-6 col-xs-6 col-sm-6 col-lg-6'>
123+
<div style={ { display: hidePageList } }
124+
className='col-md-6 col-xs-6 col-sm-6 col-lg-6'>
122125
{ pageBtns }
123126
</div>
124127
</div>
@@ -298,7 +301,8 @@ PaginationList.propTypes = {
298301
prePageTitle: PropTypes.string,
299302
nextPageTitle: PropTypes.string,
300303
firstPageTitle: PropTypes.string,
301-
lastPageTitle: PropTypes.string
304+
lastPageTitle: PropTypes.string,
305+
hidePageListOnlyOnePage: PropTypes.bool
302306
};
303307

304308
PaginationList.defaultProps = {

0 commit comments

Comments
 (0)