Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

onSelect callback is executed when limit is reached in multiple mode #1794

Closed
orestisioakeimidis opened this issue Sep 6, 2016 · 4 comments

Comments

@orestisioakeimidis
Copy link

orestisioakeimidis commented Sep 6, 2016

Bug description:

The onSelect callback is executed when limit is reached for multiple select. That shouldn't be the case because nothing is actually selected.

Link to minimally-working plunker that reproduces the issue:

Example

Version of Angular, UI-Select, and Bootstrap/Select2/Selectize CSS

Angular: 1.5.8

UI-Select: 0.19.4

@orestisioakeimidis orestisioakeimidis changed the title The onSelect callback is executed when limit is reached in multiple model The onSelect callback is executed when limit is reached in multiple mode Sep 6, 2016
@orestisioakeimidis orestisioakeimidis changed the title The onSelect callback is executed when limit is reached in multiple mode onSelect callback is executed when limit is reached in multiple mode Sep 6, 2016
@Jefiozie
Copy link
Contributor

Jefiozie commented Sep 8, 2016

What do you believe is the best way to fix this. Just a check on the limit but then the items in the list are still clickable? Or disable all the items?

@orestisioakeimidis
Copy link
Author

orestisioakeimidis commented Sep 8, 2016

I think that also the items should be disabled. You have reached the limit and you are not allowed to select any more, so it makes sense to disable them. What do you think @Jefiozie?

@orestisioakeimidis
Copy link
Author

What is the status of this case?

@Jefiozie
Copy link
Contributor

Jefiozie commented Sep 25, 2016

Sorry didn't have a lot of time. I agree on the disabled state when you are on the defined limit. Maybe you can make a PR? Happy to review!

kboga pushed a commit to kboga/ui-select that referenced this issue Nov 29, 2016
…eached

Previously if a limit was defined for a multiple selection ui-select 
and that limit was reached, the onSelectCallback would still be fired 
even though the item wasn't actually selected. 

This commit moves the firing of the callback to after the select has 
actually taken place to ensure it is only fired on the correct 
occassions.

Fixes angular-ui#1794 
Closes angular-ui#1836
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants