Skip to content

Commit

Permalink
Call props.onChange only when closing filter (apache#4003)
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida authored and mistercrunch committed Dec 5, 2017
1 parent 0e91f31 commit 7b78f60
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,6 @@ export default class DateFilterControl extends React.Component {
onNumberChange(event) {
this.setState({ num: event.target.value }, this.onChange);
}
onChange() {
let val;
if (this.state.type === 'rel') {
val = `${this.state.num} ${this.state.grain} ${this.state.rel}`;
} else if (this.state.type === 'fix') {
val = this.state.dttm;
} else if (this.state.type === 'free') {
val = this.state.free;
}
this.props.onChange(val);
}
onFreeChange(event) {
this.setState({ free: event.target.value }, this.onChange);
}
Expand All @@ -88,6 +77,15 @@ export default class DateFilterControl extends React.Component {
this.setState({ dttm: dttm.format().substring(0, 19) }, this.onChange);
}
close() {
let val;
if (this.state.type === 'rel') {
val = `${this.state.num} ${this.state.grain} ${this.state.rel}`;
} else if (this.state.type === 'fix') {
val = this.state.dttm;
} else if (this.state.type === 'free') {
val = this.state.free;
}
this.props.onChange(val);
this.refs.trigger.hide();
}
renderPopover() {
Expand Down

0 comments on commit 7b78f60

Please sign in to comment.