MudBlazor icon indicating copy to clipboard operation
MudBlazor copied to clipboard

MudSelect: Changing the bound Value does not fire SelectedValuesChanged event and does not perform required check

Open danthe74 opened this issue 4 years ago • 5 comments

Bug type

Component

Component name

MudSelect

What happened?

There is a list of strings in a MudSelect. If I change the value of the variable bound to MudSelect, the value is changed but the SelectedValuesChanged event is not fired and also the required check is not executed.

Expected behavior

SelectedValuesChanged event is fired and the required check is performed.

If I use the MudSelect<T>.SelectOption() method based on the reference to the MudSelect, the SelectedValuesChanged event is fired and the Required check is also performed.

Reproduction link

https://try.mudblazor.com/snippet/cOQbujGLxTJQqiiD

Reproduction steps

  1. Select a value by Button "Select this Item by binded value" => No Event Fired Messge appears.
  2. Clear the select field => The Required-Check is performed and the Event Fired Message is displayed.
  3. use the button "Select this Item by binded value" on more time => No Event Fired Messge appears. => The Field is still marked as required. The Required-Error-Message is displayed
  4. Using the Button "Select this Item by ref-Object" sets the value to the selected one and the Event Fired Message is displayed.

Relevant log output

Nothing

Version (bug)

v.5.1.4

Version (working)

No response

What browsers are you seeing the problem on?

Firefox

On what operating system are you experiencing the issue?

Windows

Pull Request

  • [ ] I would like to do a Pull Request

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

danthe74 avatar Sep 27 '21 11:09 danthe74

Could be a similar problem as in #2852.

danthe74 avatar Sep 27 '21 11:09 danthe74

@henon is this an expecting result?

mckaragoz avatar Oct 16 '21 19:10 mckaragoz

Changing the bound-Value

sanepete avatar Apr 09 '22 00:04 sanepete

Hi. We are just stuck on this problem. It is very annoying. Is there any workaround for it?

MooWeek avatar Sep 05 '22 12:09 MooWeek

@MooWeek Does it annoy you enough so you maybe try to fix it and PR?

henon avatar Sep 05 '22 12:09 henon

Running into this issue now as well. I don't have the time to submit a PR. Bummer was hoping most of these issues would have been resolved in MudBlazor by now. I agree with @henon that we need more contributors. I ended up using CodeBeamExtensions

enkodellc avatar Sep 18 '23 18:09 enkodellc

It seems this issue is fixed? - If you need to use "SelectedValuesChanged" then you have to use "SelectedValues" in place of "@bind-SelectedValues".

garyscode avatar Mar 04 '24 16:03 garyscode