From 544cd261b8f1da42173f5cb00dc61f32fa7b04a7 Mon Sep 17 00:00:00 2001 From: AllenFang Date: Thu, 9 Jun 2016 16:43:57 +0800 Subject: [PATCH] fix currPage always to be options value if setState --- src/BootstrapTable.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/BootstrapTable.js b/src/BootstrapTable.js index a6265e726..ff80d3cfe 100644 --- a/src/BootstrapTable.js +++ b/src/BootstrapTable.js @@ -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()) { @@ -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)) {