-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onDropDownClose is called much more than expected #127
Comments
me too. |
Have you guys found a solution for this issue. |
I am also facing the same issue where function behind OnDropDownClose is getting triggered on click of mouse. One way i used to work around is that i had the event binded in all the other methods such as OnSelect, OnSelectAll, onDeselect & OnDeselectAll. So, this satisfied the scenario for me that only when selection changed, it triggered the event. Hope it helps someone! |
i got same issue |
I am running with the same issue |
Same here. |
This was driving me insane. Sucks to see this as the issue. |
Can you more clearly explain your workaround? |
The problem is because closeDropdown() doesn't check if the drop down is already closed or not before emitting and the click outside directive is blindly calling closeDropdown() everytime someone clicks anywhere outside the dropdown. This is a pretty major bug. It means that you cannot use the onDropDownClose event. In my case, I need to fire service calls on dropdown close but not on select or deselect, so it's a bit of a mess trying to manually handle the dropdown state from the outside. [edit] Seems to fix it. I'll make a pull request in a little while. |
Actually in addition to that PR, we need to change the way that the clickOutside directive works, so that the click handler only binds when the dropdown is open. |
@NileshPatel17 |
Use ngModelChange,<ng-multiselect-dropdown [data]="dataSource" [(ngModel)]="dropDownSelection" [settings]="dropDownSettings" (click)="dropDownSelect = true" (ngModelChange)="saveFunction($event)"> |
There is no documentation on how this should work, but I would expect other behavior.
When
(onDropDownClose)="close()"
is used,close()
is called not only when dropdown is closes, but also every time mouse is clicked anywhere else except component.https://stackblitz.com/edit/angular-cvzxsx - click anywhere on the white background to see how each time message is logged to the console.
The text was updated successfully, but these errors were encountered: