Skip to content
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

Multiselect fix: disable options if selectionLimit reached by default value #7976

Closed
wants to merge 1 commit into from
Closed

Multiselect fix: disable options if selectionLimit reached by default value #7976

wants to merge 1 commit into from

Conversation

monim67
Copy link

@monim67 monim67 commented Jul 22, 2019

Defect Fixes

Why use ngDoCheck?

I could set the value of maxSelectionLimitReached in writeValue method. But using ChangeDetection
ensures the check-boxes are updated even if selectionLimit or options are updated later. I could not
use ngAfterViewChecked for that as the value of maxSelectionLimitReached is used in the template.

Why remove some code?

As the value of maxSelectionLimitReached is set though ChangeDetection, we don't need to set it
on checkbox click event anymore.

@cagataycivici
Copy link
Member

doCheck will cause performance issues, should better to it at writeValue.

@monim67
Copy link
Author

monim67 commented Jul 23, 2019

@cagataycivici the checking can be moved to ngOnChanges, is there any performance issues? My motive here is to keep the selectionLimit working even if I set/update selectionLimit or the options dynamically after the multi-select is initialized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants