Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Manage outsideclick event on FiltersNotFrequent component #1387
Browse files Browse the repository at this point in the history
  • Loading branch information
wiadev committed Jan 17, 2018
1 parent 6a2695e commit 438470f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/actions/ViewActions.js
Expand Up @@ -93,7 +93,6 @@ export function filterViewRequest(windowId, viewId, filters) {
}
});
});
console.log(filters);
return axios.post(
config.API_URL + "/documentView/" + windowId + "/" + viewId + "/filter",
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/filters/FiltersFrequent.js
Expand Up @@ -33,7 +33,7 @@ class FiltersFrequent extends Component {
const { widgetShown, dropdownToggled } = this.props;
const { allowOutsideClickListener } = this.state;
if (allowOutsideClickListener) {
!widgetShown && this.toggleFilter(null, null);
!widgetShown && this.toggleFilter(null);
dropdownToggled();
}
};
Expand Down
11 changes: 9 additions & 2 deletions src/components/filters/FiltersNotFrequent.js
Expand Up @@ -12,7 +12,8 @@ class FiltersNotFrequent extends Component {

this.state = {
isOpenDropdown: false,
openFilterId: null
openFilterId: null,
allowOutsideClickListener: true
};
}

Expand All @@ -22,13 +23,18 @@ class FiltersNotFrequent extends Component {

outsideClick = () => {
const { widgetShown, dropdownToggled } = this.props;
if (!widgetShown) {
const { allowOutsideClickListener } = this.state;
if (allowOutsideClickListener && !widgetShown) {
dropdownToggled();
this.toggleDropdown(false);
this.toggleFilter(null);
}
};

allowOutsideClickListener = value => {
this.setState({ allowOutsideClickListener: value });
};

toggleDropdown = value => {
this.setState({
isOpenDropdown: value
Expand Down Expand Up @@ -119,6 +125,7 @@ class FiltersNotFrequent extends Component {
onHide={() => handleShow(false)}
viewId={viewId}
outsideClick={this.outsideClick}
allowOutsideClickListener={this.allowOutsideClickListener}
/>
)}
</div>
Expand Down

0 comments on commit 438470f

Please sign in to comment.