-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
[FEATURE] - "Select All" option with toggle to clear #145
Comments
@allensutton sounds like a good idea. would you like to start working on this? I can help you if you need assistance, just send me a link to your code. |
Sure, I can give it a shot. I have a previous stackblitz here: https://stackblitz.com/edit/github-mfmoas However, I think I accidentally overwrote the concept I had going, so I'll see if I can get back to where I was where I had the "select all" working but not the "clear all" part. |
I just found out that Material has added this: It has selectAll() and deselectAll() methods |
@allensutton can we close this issue? |
@macjohnny this feature would be a welcome one. The selectAll(), deselectAll() methods that @allensutton pointed out in his last comment appear to only be for the mat-selection-list component and not the mat-select component. ideally, the implementation would function similar to the the example you mentioned above ( https://stackblitz.com/edit/mat-select-autocomplete-formcontrol ). where the checkbox is in the search box and it will select the results that are returned by the filter *edit - I've created a stackblitz roughly creating the functionality. there is a checkbox added which emits a boolean whether to select all, that the parent component then uses to patch the form value with the filtered selection. https://stackblitz.com/edit/mat-select-search-with-select-all |
Would you like to file a PR for this? |
Sure thing, I've never worked on a public repo before. Is there anything in particular needed for approval? I've got a working copy now, just finishing up some styling. |
Just give it a try, we will have a look at it in the code review to see what could be changed. |
this is released in version |
Is your feature request related to a problem? Please describe.
If there are a lot of options, it is a bit tedious to select them one by one if the user merely wants to select all of them. In addition, it would be tedious to deselect all of the selected items.
Describe the solution you'd like
Please add a way to add functionality for a "Select All" option that would be clicked to select every item in the list, and when the user clicks on the Select All option again, it will clear the selections that have been made. It would also be good if selecting all items manually automatically checked the "Select All" option (due to all items being selected).
Describe alternatives you've considered
mat-select-autocomplete-formcontrol does this, however your ngx-mat-select-search solution looks better visually. I have attempted to do this myself, but I can only get "Select All" to work, but it takes a few seconds to work. I cannot get Clear All to work, however.
Additional context
This is a similar implementation: https://stackblitz.com/edit/mat-select-autocomplete-formcontrol
The text was updated successfully, but these errors were encountered: