Skip to content
Snippets Groups Projects
Commit 64d1c907 authored by Kyle Doherty's avatar Kyle Doherty Committed by GitHub
Browse files

commit filter on enter [WIP] (#4574)

* commit filter on enter

* fix context issue

* use key instead of keycode

* properly bind function
parent 718f788d
Branches
Tags
No related merge requests found
......@@ -55,6 +55,20 @@ export default class FilterPopover extends Component<*, Props, State> {
tableMetadata: PropTypes.object.isRequired
};
componentWillMount() {
window.addEventListener('keydown', this.commitOnEnter);
}
componentWillUnmount() {
window.removeEventListener('keydown', this.commitOnEnter);
}
commitOnEnter = (event: KeyboardEvent) => {
if(this.isValid() && event.key === "Enter") {
this.commitFilter(this.state.filter);
}
}
commitFilter = (filter: FieldFilter) => {
this.props.onCommitFilter(filter);
this.props.onClose();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment