fix remote filter/search broken when pagination enabled

This commit is contained in:
AllenFang
2019-02-09 18:01:53 +08:00
parent 63c2630f46
commit d7f84a9da5
3 changed files with 14 additions and 0 deletions

View File

@@ -37,6 +37,14 @@ export default (
}
}
componentWillReceiveProps(nextProps) {
if (isRemoteFiltering()) {
this.setState({
data: nextProps.data
});
}
}
onFilter(column, filterType, initialize = false) {
return (filterVal) => {
// watch out here if migration to context API, #334

View File

@@ -52,6 +52,7 @@ class StateProvider extends React.Component {
if (this.isRemotePagination() || custom) {
this.currPage = nextProps.pagination.options.page;
this.currSizePerPage = nextProps.pagination.options.sizePerPage;
this.dataSize = nextProps.pagination.options.totalSize;
}
}

View File

@@ -1,6 +1,7 @@
/* eslint react/prop-types: 0 */
/* eslint react/require-default-props: 0 */
/* eslint no-continue: 0 */
/* eslint no-lonely-if: 0 */
import React from 'react';
import PropTypes from 'prop-types';
@@ -44,6 +45,10 @@ export default (options = {
data: result
});
}
} else {
if (isRemoteSearch()) {
this.setState({ data: nextProps.data });
}
}
}