mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
avoid infinite remote search
This commit is contained in:
parent
e3ca6f2c24
commit
5e63d6ae59
@ -20,11 +20,26 @@ export default (options = {
|
||||
searchText: PropTypes.string
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.performRemoteSearch = props.searchText !== '';
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (isRemoteSearch()) {
|
||||
if (nextProps.searchText !== this.props.searchText) {
|
||||
this.performRemoteSearch = true;
|
||||
} else {
|
||||
this.performRemoteSearch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
search() {
|
||||
const { data, columns } = this.props;
|
||||
let { searchText } = this.props;
|
||||
|
||||
if (isRemoteSearch()) {
|
||||
if (isRemoteSearch() && this.performRemoteSearch) {
|
||||
handleRemoteSearchChange(searchText);
|
||||
return data;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user