From a90cf518a3f70c1b6dafbf18f41d1246f2c5bac3 Mon Sep 17 00:00:00 2001 From: markosteger Date: Thu, 16 Feb 2023 11:32:10 +0100 Subject: [PATCH] Fixes for InputAttributes in SimpleSelect --- .../Pages/Index.razor | 13 +++++++------ .../Components/SimpleSelect.razor.cs | 15 ++++++++++----- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Connected.Components.Showcase.Runner/Pages/Index.razor b/src/Connected.Components.Showcase.Runner/Pages/Index.razor index 6f94a83..883720b 100644 --- a/src/Connected.Components.Showcase.Runner/Pages/Index.razor +++ b/src/Connected.Components.Showcase.Runner/Pages/Index.razor @@ -6,12 +6,13 @@

SelectedValue: @SelectedValue.ToString()

- - + + + + + + + @code { diff --git a/src/Connected.Components/Components/SimpleSelect.razor.cs b/src/Connected.Components/Components/SimpleSelect.razor.cs index 2baadb7..0490ae6 100644 --- a/src/Connected.Components/Components/SimpleSelect.razor.cs +++ b/src/Connected.Components/Components/SimpleSelect.razor.cs @@ -76,13 +76,18 @@ public partial class SimpleSelect : InputBase protected override async Task OnParametersSetAsync() { - if (base.InputAttributes is null) base.InputAttributes = new(); - if (base.Required) - { - if (base.InputAttributes.ContainsKey("required")) base.InputAttributes.Add("required", true); - } + OriginalItems = Items; if (_searchText.Length>0) await FilterItems(); + await base.OnParametersSetAsync(); + } + + protected override async Task OnInitializedAsync() + { await base.OnInitializedAsync(); + if (Required) + { + if (InputAttributes.ContainsKey("required")) InputAttributes.Add("required", true); + } } } \ No newline at end of file