Skip to content

Commit d7f84a9

Browse files
committed
fix remote filter/search broken when pagination enabled
1 parent 63c2630 commit d7f84a9

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

packages/react-bootstrap-table2-filter/src/context.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ export default (
3737
}
3838
}
3939

40+
componentWillReceiveProps(nextProps) {
41+
if (isRemoteFiltering()) {
42+
this.setState({
43+
data: nextProps.data
44+
});
45+
}
46+
}
47+
4048
onFilter(column, filterType, initialize = false) {
4149
return (filterVal) => {
4250
// watch out here if migration to context API, #334

packages/react-bootstrap-table2-paginator/src/state-context.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class StateProvider extends React.Component {
5252
if (this.isRemotePagination() || custom) {
5353
this.currPage = nextProps.pagination.options.page;
5454
this.currSizePerPage = nextProps.pagination.options.sizePerPage;
55+
this.dataSize = nextProps.pagination.options.totalSize;
5556
}
5657
}
5758

packages/react-bootstrap-table2-toolkit/src/search/context.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint react/prop-types: 0 */
22
/* eslint react/require-default-props: 0 */
33
/* eslint no-continue: 0 */
4+
/* eslint no-lonely-if: 0 */
45
import React from 'react';
56
import PropTypes from 'prop-types';
67

@@ -44,6 +45,10 @@ export default (options = {
4445
data: result
4546
});
4647
}
48+
} else {
49+
if (isRemoteSearch()) {
50+
this.setState({ data: nextProps.data });
51+
}
4752
}
4853
}
4954

0 commit comments

Comments
 (0)