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

RadioGroup-Buttons rendering incorrectly with enums #859

Closed
jostapotcf opened this issue May 4, 2020 · 2 comments
Closed

RadioGroup-Buttons rendering incorrectly with enums #859

jostapotcf opened this issue May 4, 2020 · 2 comments
Labels
Type: Bug 🐞 Something isn't working Type: Quick Fix
Milestone

Comments

@jostapotcf
Copy link

Describe the bug

This works fine: 2 way binding and renders correctly

<RadioGroup TValue="MeasurementSystem" Name="MeasurementSystem" @bind-CheckedValue="VM.MeasurementSystem" Inline="true">
     <Radio Value="@(MeasurementSystem.IP)">IP</Radio>
     <Radio Value="@(MeasurementSystem.SI)">SI</Radio>
</RadioGroup>

Where Measurement system is the enum:

    public enum MeasurementSystem
    {
        IP = 0,
        SI = 1
    }

This does not work: 2 way binding works, but after initial rendering, visual state is lost and css classes are not modified correctly. (the only difference from the first razor example is the addition of buttons="true")

<RadioGroup TValue="MeasurementSystem" Name="MeasurementSystem" @bind-CheckedValue="VM.MeasurementSystem" Buttons="true">
    <Radio Value="@(MeasurementSystem.IP)">IP</Radio>
    <Radio Value="@(MeasurementSystem.SI)">SI</Radio>
</RadioGroup>

Expected behavior
Would expect the rendering to work properly, with an active class being attached to button of the currently active value. (so it can be styled accordingly)

PS> I wanted to say thank you and everyone who has contributed to Blazorise. I just started playing with it a couple days and I've been very impressed.

@stsrki
Copy link
Collaborator

stsrki commented May 4, 2020

Thanks for detail report. I was able to reproduce the error and it will be fixed in the next patch.

@stsrki stsrki added Type: Bug 🐞 Something isn't working Type: Quick Fix labels May 4, 2020
@stsrki stsrki added this to the 0.9 milestone May 4, 2020
@stsrki
Copy link
Collaborator

stsrki commented May 4, 2020

Not for me so I don't forget! Problem is in ParseValueFromStringAsync in BaseCheckComponent. First line should be var parsedValue = ( value?.ToLowerInvariant() == TrueValueName?.ToLowerInvariant() ).ToString();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐞 Something isn't working Type: Quick Fix
Projects
Archived in project
Development

No branches or pull requests

2 participants