-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Support binding to <select multiple>, getting/setting the selection as an array #5519
Comments
I have checked #805 and it looks that in simple binding scenario it doesn't work either. The question is: what data type should we use to bind to "select multiple" and what should be returned in e.Value? Array of strings or simple string (multiple values with separators)? |
Great point to raise. We don't have any specific API in place for this scenario. I guess a reasonable design would be binding to a We can add it to the backlog. |
Just to be clear, Blazor doesn't currently support selects that are defined as multi select? If it doesn't, is there a simple way around it? |
@pjmagee There is a workaround. I used a javascript interop call to get the list of selected items from the list. To set the initial selections, you can set the
in the html page include the getSelectedValues function. The function below works, but
|
Hi Steve. I cannot find any new information on this, could you confirm if this is still in the backlog or if it has been implemented? Thanks. |
It is still in the backlog. Currently we're focused on shipping Blazor WebAssembly, during which we're not making any changes to the core Blazor components programming model. The next phase during which we'll do programming model enhancements is for .NET 5, which we'll be working on between May and November. |
Still not working ? |
Any Updates? |
I can't seem to find it on the project board (https://github.com/dotnet/aspnetcore/projects/12). is it still planned for the .NET5 release? |
No, sorry, this was never planned for .NET 5 (I only said that was the earliest it could be done). We packed in absolutely as much as we could, but this didn’t make the cut. I know that will seem disappointing if this one was particularly important to you. For now if you need this you’d need to implement it manually. Sorry! It’s on the backlog that we’ll review for .NET 6. |
Thanks for contacting us. |
Okay, so it would have been nice if this had been working already, but what @mikewodarczyk wrote doesn't work anymore. What works for me currently is:
And then as HTML:
JS stays the same as mikewodarczyk wrote, but let's at least use Typescript ;)
|
Closing because this was done in #33950. |
With the following code
Holding down the ctrl key, if you select 'volvo' first and then any other value, e.value is always 'volvo'. It basically returns the top selected item in the list.
The text was updated successfully, but these errors were encountered: