Skip to content

Commit 51e936b

Browse files
Merge dimodi-patch-1-combo-kb-3059 into production (#3060)
* kb(ComboBox): Fix corner case * Update knowledge-base/combobox-auto-select-on-blur.md --------- Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com>
1 parent 924bdf6 commit 51e936b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

knowledge-base/combobox-auto-select-on-blur.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ To automatically select the first matching item in the ComboBox when the input l
6666
<ComboBoxPopupSettings Class="select-on-tab" />
6767
</ComboBoxSettings>
6868
</TelerikComboBox>
69-
<br/>
70-
<br/>
71-
<TelerikTextBox Placeholder="Next form item" Width="200px"/>
69+
<br />
70+
<br />
71+
<TelerikTextBox Placeholder="Next form item" Width="200px" />
7272
7373
@* Move JavaScript to a separate JS file *@
7474
<script suppress-error="BL9992">
75-
function attachComboKeyDown(selector) {
75+
function attachComboKeyDown(selector) {
7676
var comboInput = document.querySelector(selector);
7777
if (comboInput) {
7878
comboInput.addEventListener("keydown", onComboInputKeyDown);
@@ -109,7 +109,7 @@ To automatically select the first matching item in the ComboBox when the input l
109109
[JSInvokable("OnComboBoxTab")]
110110
public void OnComboBoxTab(string newStringValue)
111111
{
112-
if (ComboBoxFirstItem is not null && ComboBoxFirstItem.Text.Contains(newStringValue))
112+
if (ComboBoxFirstItem is not null && ComboBoxFirstItem.Text.ToLowerInvariant().Contains(newStringValue.ToLowerInvariant()))
113113
{
114114
ComboBoxValue = ComboBoxFirstItem.Id;
115115
ComboBoxFirstItem = default;
@@ -131,7 +131,7 @@ To automatically select the first matching item in the ComboBox when the input l
131131
args.Data = result.Data;
132132
args.Total = result.Total;
133133
134-
if (args.Request.Filters.Count > 0)
134+
if (args.Request.Filters.Count > 0 && result.Data.Cast<ListItem>().Count() > 0)
135135
{
136136
ComboBoxFirstItem = args.Data.Cast<ListItem>().First();
137137
}
@@ -160,10 +160,10 @@ To automatically select the first matching item in the ComboBox when the input l
160160
for (int i = 1; i <= 24; i++)
161161
{
162162
ComboBoxData.Add(new ListItem()
163-
{
164-
Id = i,
165-
Text = $"Item {i}"
166-
});
163+
{
164+
Id = i,
165+
Text = $"Item {i}"
166+
});
167167
}
168168
}
169169
@@ -182,4 +182,4 @@ To automatically select the first matching item in the ComboBox when the input l
182182
````
183183
## See Also
184184

185-
- [ComboBox Events](slug:components/combobox/events)
185+
- [ComboBox Events](slug:components/combobox/events)

0 commit comments

Comments
 (0)