Skip to content

Commit

Permalink
fix currPage always to be options value if setState
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Jun 9, 2016
1 parent 665161a commit 544cd26
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,15 @@ class BootstrapTable extends Component {

this.store.setData(nextProps.data.slice());

let page;
if (options.page != null) {
// from #481
let page = this.state.currPage;
if (this.props.options.page !== options.page) {
page = options.page;
} else {
page = this.state.currPage;
}
// from #481
let sizePerPage = this.state.sizePerPage;
if (this.props.options.sizePerPage !== options.sizePerPage) {
sizePerPage = options.sizePerPage;
}

if (this.isRemoteDataSource()) {
Expand All @@ -157,13 +161,6 @@ class BootstrapTable extends Component {
currPage: page
});
} else {
// #481
// const sizePerPage = options.sizePerPage || this.state.sizePerPage;
let sizePerPage = this.state.sizePerPage;
if (this.props.options.sizePerPage !== options.sizePerPage) {
sizePerPage = options.sizePerPage;
}

// #125
if (!options.page &&
page >= Math.ceil(nextProps.data.length / sizePerPage)) {
Expand Down

0 comments on commit 544cd26

Please sign in to comment.