Skip to content

Commit

Permalink
fix #1257
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed May 6, 2017
1 parent d80460b commit 5234375
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ class BootstrapTable extends Component {
sizePerPageDropDown={ options.sizePerPageDropDown }
hidePageListOnlyOnePage={ options.hidePageListOnlyOnePage }
paginationPanel={ options.paginationPanel }
keepSizePerPageState={ options.keepSizePerPageState }
open={ false }/>
</div>
);
Expand Down Expand Up @@ -1373,6 +1374,7 @@ BootstrapTable.propTypes = {
hidePageListOnlyOnePage: PropTypes.bool,
alwaysShowAllBtns: PropTypes.bool,
withFirstAndLast: PropTypes.bool,
keepSizePerPageState: PropTypes.bool,
onSortChange: PropTypes.func,
onPageChange: PropTypes.func,
onSizePerPageList: PropTypes.func,
Expand Down Expand Up @@ -1525,6 +1527,7 @@ BootstrapTable.defaultProps = {
hidePageListOnlyOnePage: false,
alwaysShowAllBtns: false,
withFirstAndLast: true,
keepSizePerPageState: false,
onSizePerPageList: undefined,
noDataText: undefined,
withoutNoDataText: false,
Expand Down
16 changes: 11 additions & 5 deletions src/pagination/PaginationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ class PaginationList extends Component {
}

componentWillReceiveProps() {
this.setState({ open: false });
const { keepSizePerPageState } = this.props;
if (!keepSizePerPageState) {
this.setState({ open: false });
}
}

changePage = page => {
Expand All @@ -25,7 +28,8 @@ class PaginationList extends Component {
nextPage,
lastPage,
firstPage,
sizePerPage
sizePerPage,
keepSizePerPageState
} = this.props;

if (page === prePage) {
Expand All @@ -40,6 +44,8 @@ class PaginationList extends Component {
page = parseInt(page, 10);
}

if (keepSizePerPageState) { this.setState({ open: false }); }

if (page !== currPage) {
this.props.changePage(page, sizePerPage);
}
Expand All @@ -56,9 +62,8 @@ class PaginationList extends Component {
if (this.props.onSizePerPageList) {
this.props.onSizePerPageList(selectSize);
}
} else {
this.setState({ open: false });
}
this.setState({ open: false });
}

toggleDropDown = () => {
Expand Down Expand Up @@ -302,7 +307,8 @@ PaginationList.propTypes = {
nextPageTitle: PropTypes.string,
firstPageTitle: PropTypes.string,
lastPageTitle: PropTypes.string,
hidePageListOnlyOnePage: PropTypes.bool
hidePageListOnlyOnePage: PropTypes.bool,
keepSizePerPageState: PropTypes.bool
};

PaginationList.defaultProps = {
Expand Down

0 comments on commit 5234375

Please sign in to comment.