This commit is contained in:
Allen 2018-08-11 15:17:41 +08:00 committed by GitHub
parent b181c98a38
commit f0fd06a5f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 16 deletions

View File

@ -48,7 +48,9 @@ class ToolkitProvider extends statelessDrcorator(React.Component) {
}
onSearch(searchText) {
this.setState({ searchText });
if (searchText !== this.state.searchText) {
this.setState({ searchText });
}
}
/**

View File

@ -20,25 +20,10 @@ export default (options = {
searchText: PropTypes.string
}
constructor(props) {
super(props);
this.needToSearch = true;
}
componentWillReceiveProps(nextProps) {
if (nextProps.searchText !== this.props.searchText) {
this.needToSearch = true;
} else {
this.needToSearch = false;
}
}
search() {
const { data, columns } = this.props;
let { searchText } = this.props;
if (!this.needToSearch) return data;
if (isRemoteSearch()) {
handleRemoteSearchChange(searchText);
return data;