Skip to content

Commit e716f38

Browse files
authored
kb(ComboBox): Fix corner case (#3059)
* kb(ComboBox): Fix corner case * Update knowledge-base/combobox-auto-select-on-blur.md
1 parent ee3691a commit e716f38

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy