OnSelect { get; set; } = default!;
@@ -19,26 +15,17 @@
[Parameter, EditorRequired]
public T? SelectedOption { get; set; }
- protected override void OnParametersSet()
- {
- selectedItemId = SelectedOption != null ? GetId(SelectedOption) : "";
-
- }
-
private string htmlLabel => Label.Replace("-", "");
- private string selectedItemId { get; set; }
-
private void onSelect(T option)
{
SelectedOption = option;
- selectedItemId = GetId(option);
OnSelect(SelectedOption);
}
- private string getButtonClasS(T option)
+ private string getButtonClass(T option)
{
- var partClass = selectedItemId == GetId(option) ? "primary" : "outline-primary";
+ var partClass = GetName(option) == GetName(SelectedOption) ? "primary" : "outline-primary";
return $"mx-1 btn btn-{partClass}";
}
}
@@ -46,8 +33,8 @@
@foreach(var option in Options)
{
-