-
Notifications
You must be signed in to change notification settings - Fork 377
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
fix: SelectedOption/Value not set correctly in FluentCombobox when selected by code #1485
Comments
Looking into it, but... you do know a combobox allows people to change the value selected from a list manually, right? So setting food category to 'drink drank drank' by the user when selecting 'milk' in the food drop down is possible and valid and can not be prevented |
Hi @vnbaaij , i have a gut feeling it has to do with ParametersView.Empty being passed to the base, which does the actual selection. we are aware of this, and is actually the wanted behavior. the value we are setting in the combobox is the default of the loaded model. the user can change it after its been filled in, incase there is a deviance from the default. :D a better way to think of it would be when we talk about medicine. medicine A is selected, which has 2 ways to be administered. one is default for medicine A, but can be changed depending on the patient's status :) |
Ok, good to have the use case clear. It is indeed the SetParameters causing this. It's different from the other list based components. Still digging... |
Hi, Please check the fix provided in the PR linked above. After we merge this PR in, a preview package containing this fix will be available on NuGet the following day. I will let you know here once that is done. |
Hi Vincent, Ive looked at the code and i suspect it will work. however, i will check the fix tomorrow while im in the office to verify it! anyway, thanks for the quick response and i will be in touch tomorrow |
i have sent the new version to my coworkers to verify in the application we are making and have verified that it works as expected. thanks a lot for the quick response! |
The PR has been merged (auto closed this issue as well). A preview package for 4.4.2 containing this PR will be released this night at 3AM (auto build pipeline) so will be on NuGet tomorrow morning. |
I am experiencing the same issue, but with a Just looking through the code a bit, it seems like The logic in |
Did you take a look at https://www.fluentui-blazor.net/Combobox#pre-selected-option? It is working correctly and showing what seems to be your use case. |
Ups, my mistake. After trying to create a simple example to show the error, I realized it's a bit of a different setup. |
🐛 Bug Report
When a Combobox has its SelectedOption bound by variable, and set from code behind, the
fluent-option
gets theselected
attribute, butaria-selected
is not set correctly, the class is not set toselected
and thefluent-combobox
'scurrent-value
is not updated either.i saw issue #983 and PR #1149, which sounded like they were related, but this seems to go further than just the properties.
im currently investigating this, but haven't found the problem yet.
💻 Repro or Code Sample
i changed the combobox' storybook "Option Template" case to the following :
🤔 Expected Behavior
Selection in combobox to change when the button is pressed
😯 Current Behavior
When a Combobox has its SelectedOption bound by variable, and set from code behind, the
fluent-option
gets theselected
attribute, but nothing else. leaving the control to look like it still has the previous selection💁 Possible Solution
still investigating to find the bug and fix it. idk if @pk9r327 has an idea?
after some looking around, it seems the overwriting of
SetParametersAsync
changes the behaviour and doesn't do the selection like it should?🔦 Context
we have a form that is bound to a model. the combobox is part of a field of said model and can be set/changed by another control.
think food category combobox that gets set to 'drink' when selecting 'milk' in the food drop down
🌍 Your Environment
The text was updated successfully, but these errors were encountered: