Thanks for your good work!
I've encountered an issue with Guid's in SelectEdit's SelectedValueChanged as follows:
<SelectEdit TValue="Guid" SelectedValue="@(Guid.Parse("00cd0391-5e22-4729-855a-fec86267722c"))" SelectedValueChanged="@ChangedGuid">
<SelectItem Value="@(Guid.Parse("413a7c18-b190-4f58-a967-338cd1566e97"))">ciC</SelectItem>
<SelectItem Value="@(Guid.Parse("00cd0391-5e22-4729-855a-fec86267722c"))">ciB</SelectItem>
<SelectItem Value="@(Guid.Parse("bca8ef46-abb7-4aec-b700-90b2b730a382"))">ciA</SelectItem>
</SelectEdit>
```c#
void ChangedGuid(Guid item)
{
Console.WriteLine("selected " + item.ToString()); //always prints Guid.Empty
}
and
```html
<SelectEdit TValue="Guid?" SelectedValue="@((Guid?)Guid.Parse("00cd0391-5e22-4729-855a-fec86267722c"))" SelectedValueChanged="@ChangedNullableGuid">
<SelectItem Value="@((Guid?)Guid.Parse("413a7c18-b190-4f58-a967-338cd1566e97"))">ciC</SelectItem>
<SelectItem Value="@((Guid?)Guid.Parse("00cd0391-5e22-4729-855a-fec86267722c"))">ciB</SelectItem>
<SelectItem Value="@((Guid?)Guid.Parse("bca8ef46-abb7-4aec-b700-90b2b730a382"))">ciA</SelectItem>
</SelectEdit>
c#
void ChangedNullableGuid(Guid? item)
{
Console.WriteLine("selected " + item?.ToString() ?? "null"); //always prints ""
}
replacing with int and int? shows no issues...
Could be a problem with Blazor, I remember _Guid_ types were not supported really well. I will see what I can do. Thanks for the report.
Bug is fixed but it will be available in v0.8
thanks a lot @stsrki ! I will look out for the release
This could be the same root cause so I'll just add to my previous issue:
I have a boolean property in my read model that for stylistic reasons I tried to display in a Select. So When I did something like this:
<Field>
<FieldLabel>Type</FieldLabel>
<SelectEdit TValue="bool" SelectedValue="@false" SelectedValueChanged="@Changed">
<SelectItem Value=@((bool)true)>True Type</SelectItem>
<SelectItem Value=@((bool)false)>False Type</SelectItem>
</SelectEdit>
</Field>
then
c#
void Changed(bool newValue) {
Console.WriteLine("Changed is : " + newValue.ToString()); //<-- always prints false
}
technically speaking I should be using a check or radio, but I can't see any reason why this shouldn't work...
I don't see good reason to go with boolean on SelectEdit but I will look into it. I guess it could be used sometimes.
The issue with boolean values is now fixed. The problem was that <option> was not supposed to work with booleans so it's value was never set. I converted it to string value internally and now the tests are passing. It will be relased with v0.8.
thanks a lot @stsrki - yeah, you never know what people are gonna do with your controls haha
Most helpful comment
I don't see good reason to go with boolean on SelectEdit but I will look into it. I guess it could be used sometimes.