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

[BUG] - Previously selected options getting deselect if modify the search #270

Closed
gurjar-prasad opened this issue Oct 23, 2020 · 11 comments · Fixed by #272
Closed

[BUG] - Previously selected options getting deselect if modify the search #270

gurjar-prasad opened this issue Oct 23, 2020 · 11 comments · Fixed by #272
Labels
bug Something isn't working
Milestone

Comments

@gurjar-prasad
Copy link

Describe the bug:
Previously selected options getting deselect if modify the search

To Reproduce:

Go to https://stackblitz.com/github/bithost-gmbh/ngx-mat-select-search-example
Scroll down to 'Multiple selection with Select All Checkbox'
Enter 'Bank C' in search
Click the select 'Bank C'
Select text 'Bank C' from search by double click on whole text or backspace and Change to 'Bank F'
Click the select 'Bank F'
Note the previously selected options have been removed

Expected behavior:
I expect Bank F should get selected from the list of options, with none of the currently selected options removed.

Addition information:
Getting this issue in:
ngx-mat-select-search version 3.1.0
angular-cli 10.0.5
angular-material 10.1.3

@gurjar-prasad gurjar-prasad added the bug Something isn't working label Oct 23, 2020
@pranavneeraj
Copy link

pranavneeraj commented Oct 23, 2020

This Can be resolved by putting the below lines in src/app/mat-select-search/mat-select-search.component.ts(Line no. 661).

  •   if (this.matSelect.multiple && !value.previousValue) {
    
  •  if (this.matSelect.multiple) {
    

Explanation:

The issue was occurring due to when the user does the filtering and then selects any value and then does some more filtering for another selection the if condition was failing.

Find Solution at this fork https://github.com/pranavneeraj/ngx-mat-select-search.

@gurjar-prasad gurjar-prasad changed the title [BUG] [BUG] - Previously selected options getting deselect if modify the search Oct 23, 2020
@macjohnny
Copy link
Member

Thanks for reporting and proposing a solution. Would you like to file a PR?

@pranavneeraj
Copy link

Thanks for reporting and proposing a solution. Would you like to file a PR?

Yes, But for filing PR will need permission for the repo. Thanks

@pravin23pawar
Copy link

We are also facing the same problem and the above proposed solution seems to work with our problem too.
Please response. Thanks for your help.

@macjohnny
Copy link
Member

@pranavneeraj you can simply fork this repo, create a branch with the fix in the forked repo, and file a PR against the original repo

@pranavneeraj
Copy link

@macjohnny Please check #271.

@macjohnny
Copy link
Member

@pranavneeraj somehow I am unable to reproduce the issue:

ngx-mat-select-search-issue-270.webm.zip

can you please post a screen video of the reproduction steps?

@pranavneeraj
Copy link

@macjohnny Please refer below recording for reference.
bug_repr.zip

@macjohnny
Copy link
Member

thanks for the screen video, I can now reproduce the issue.

@macjohnny
Copy link
Member

macjohnny commented Oct 23, 2020

the fix was released with version 3.1.2
thanks for reporting and trying to fix it!

@pranavneeraj
Copy link

the fix was released with version 3.1.2
thanks for reporting and trying to fix it!

Thanks for your quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment