resubmit query when switching between "This Room" / "All Rooms"

pull/21833/head
Bruno Windels 2019-01-16 11:13:35 +01:00
parent c07470be7b
commit cbe3afaa1f
1 changed files with 8 additions and 2 deletions

View File

@ -33,11 +33,11 @@ module.exports = React.createClass({
}, },
onThisRoomClick: function() { onThisRoomClick: function() {
this.setState({ scope: 'Room' }); this.setState({ scope: 'Room' }, () => this._searchIfQuery());
}, },
onAllRoomsClick: function() { onAllRoomsClick: function() {
this.setState({ scope: 'All' }); this.setState({ scope: 'All' }, () => this._searchIfQuery());
}, },
onSearchChange: function(e) { onSearchChange: function(e) {
@ -49,6 +49,12 @@ module.exports = React.createClass({
} }
}, },
_searchIfQuery: function() {
if (this.refs.search_term.value) {
this.onSearch();
}
},
onSearch: function() { onSearch: function() {
this.props.onSearch(this.refs.search_term.value, this.state.scope); this.props.onSearch(this.refs.search_term.value, this.state.scope);
}, },