mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2026-07-04 16:10:03 +00:00
avoid infinite remote search
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user