From b1bfeda5b7605607074acaf7d39ed72899a3c83a Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Fri, 20 Jun 2025 16:37:58 +0300 Subject: [PATCH 1/2] kb(ComboBox): Fix corner case --- .../combobox-auto-select-on-blur.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/knowledge-base/combobox-auto-select-on-blur.md b/knowledge-base/combobox-auto-select-on-blur.md index d8742793b..77aa015c8 100644 --- a/knowledge-base/combobox-auto-select-on-blur.md +++ b/knowledge-base/combobox-auto-select-on-blur.md @@ -66,13 +66,13 @@ To automatically select the first matching item in the ComboBox when the input l -
-
- +
+
+ @* Move JavaScript to a separate JS file *@ @code { - private DotNetObjectReference<__Main>? DotNetRef { get; set; } + private DotNetObjectReference? DotNetRef { get; set; } private List ComboBoxData { get; set; } = new(); private int ComboBoxValue { get; set; } @@ -109,7 +109,7 @@ To automatically select the first matching item in the ComboBox when the input l [JSInvokable("OnComboBoxTab")] public void OnComboBoxTab(string newStringValue) { - if (ComboBoxFirstItem is not null && ComboBoxFirstItem.Text.Contains(newStringValue)) + if (ComboBoxFirstItem is not null && ComboBoxFirstItem.Text.ToLowerInvariant().Contains(newStringValue.ToLowerInvariant())) { ComboBoxValue = ComboBoxFirstItem.Id; ComboBoxFirstItem = default; @@ -131,7 +131,7 @@ To automatically select the first matching item in the ComboBox when the input l args.Data = result.Data; args.Total = result.Total; - if (args.Request.Filters.Count > 0) + if (args.Request.Filters.Count > 0 && result.Data.Cast().Count() > 0) { ComboBoxFirstItem = args.Data.Cast().First(); } @@ -160,10 +160,10 @@ To automatically select the first matching item in the ComboBox when the input l for (int i = 1; i <= 24; i++) { ComboBoxData.Add(new ListItem() - { - Id = i, - Text = $"Item {i}" - }); + { + Id = i, + Text = $"Item {i}" + }); } } @@ -182,4 +182,4 @@ To automatically select the first matching item in the ComboBox when the input l ```` ## See Also -- [ComboBox Events](slug:components/combobox/events) \ No newline at end of file +- [ComboBox Events](slug:components/combobox/events) From 7b5afdd5f9351682da3097dd043b1dcaa02d16b0 Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Fri, 20 Jun 2025 16:38:40 +0300 Subject: [PATCH 2/2] Update knowledge-base/combobox-auto-select-on-blur.md --- knowledge-base/combobox-auto-select-on-blur.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knowledge-base/combobox-auto-select-on-blur.md b/knowledge-base/combobox-auto-select-on-blur.md index 77aa015c8..f8e2d7e3a 100644 --- a/knowledge-base/combobox-auto-select-on-blur.md +++ b/knowledge-base/combobox-auto-select-on-blur.md @@ -100,7 +100,7 @@ To automatically select the first matching item in the ComboBox when the input l @code { - private DotNetObjectReference? DotNetRef { get; set; } + private DotNetObjectReference<__Main>? DotNetRef { get; set; } private List ComboBoxData { get; set; } = new(); private int ComboBoxValue { get; set; }