mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
Merge pull request #371 from sean-ww/fix/remote-filtered-pagination
Prevent remote pagination from setting the page incorrectly
This commit is contained in:
commit
42c6bc0337
@ -54,11 +54,14 @@ export default (Base, {
|
||||
if (typeof page !== 'undefined' && currPage !== page) { // user defined page
|
||||
currPage = page;
|
||||
needNewState = true;
|
||||
} else if (nextProps.isDataChanged) { // user didn't defined page but data change
|
||||
currPage = typeof pageStartIndex !== 'undefined' ? pageStartIndex : Const.PAGE_START_INDEX;
|
||||
} else if (nextProps.isDataChanged) {
|
||||
needNewState = true;
|
||||
}
|
||||
|
||||
if (typeof currPage === 'undefined') {
|
||||
currPage = typeof pageStartIndex !== 'undefined' ? pageStartIndex : Const.PAGE_START_INDEX;
|
||||
}
|
||||
|
||||
if (typeof sizePerPage !== 'undefined') {
|
||||
currSizePerPage = sizePerPage;
|
||||
needNewState = true;
|
||||
|
||||
@ -177,10 +177,11 @@ describe('Wrapper', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('when nextProps.isDataChanged is true and options.pageStartIndex is existing', () => {
|
||||
describe('when nextProps.isDataChanged is true, currPage is undefined and options.pageStartIndex exists', () => {
|
||||
beforeEach(() => {
|
||||
nextProps.isDataChanged = true;
|
||||
nextProps.pagination.options.pageStartIndex = 0;
|
||||
instance.state.currPage = undefined;
|
||||
instance.componentWillReceiveProps(nextProps);
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user