We have ran into an issue using the radcombobox with ShowMoreResultsbox and MarkFirstMatch properties set to true. After typing the first letter the radcombobox is loads the first 10 items as expected that match the letter typed in, but when the show more results is clicked only one value will be retrieved. It seems the e.text value no longer passes in what was typed, but since the MarkFirstMatch was set to true the first item in the list is passed into e.text.
Is there a way to hold the original value that was passed into the ItemsRequested e.text, instead of the autocompleted value? We are wanting to still use the MarkFirstMatch.
The issue can be replicated using the Load On Demand Demo and the 103208_sample.zip sample project.
http://mono.telerik.com/Combobox/Examples/PopulatingWithData/AutoCompleteSql/DefaultCS.aspx
Add a few more companies that start will L into the database.
Open up the page with the radcombobox.
Type L.
After the RadComboBox is loaded, click the show more results button.
The list will be populated with the first 10 items. However the Summary will show “items 1-1 out of 1.”
Thanks for your help.
7 Answers, 1 is accepted
I'm having the exact same problem with v2009.1.527.35. I'm eager for the solution too.
function onItemsRequested(sender, eventArgs) { |
if (sender.get_items().get_count() > 0) |
sender.get_items().getItem(0).highlight(); |
} |
Greetings,
Simon
the Telerik team
Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
I did try the solution, but it did not accomplish what we needed. When the user tabs or clicks off the combobox it will not choose the value that is highlighted, which was why we were using the markfirstmatch. When using Mark first is there a way to separate what is typed and what is highlighted?
function onItemsRequested(sender, eventArgs) { |
markFirstMatch(sender, function(item) { if (item) item.highlight(); }); |
} |
function onDropDownClosing(sender, eventArgs) { |
markFirstMatch(sender, function(item) { if (item) item.select(); }); |
} |
function markFirstMatch(comboBox, action) { |
action(findFirstMatch(comboBox)); |
} |
function findFirstMatch(comboBox) { |
var text = comboBox.get_text(); |
if (!text) return null; |
var items = comboBox.get_items(); |
for (var i = 0, length = items.get_count(); i < length; i++) { |
var item = items.getItem(i); |
if (item.get_text().toLowerCase().indexOf(text) == 0) |
return item; |
} |
} |
Greetings,
Simon
the Telerik team
Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
<telerik:RadComboBox ID="Type" runat="server" AccessKey="T" |
AllowCustomText="false" CollapseAnimation-Type="None" |
DataTextField="Key" DataValueField="Value" |
EnableLoadOnDemand="true" ExpandDelay="0" |
EnableVirtualScrolling="true" ExpandAnimation-Type="None" |
Filter="Contains" ItemsPerRequest="20" |
OnClientItemsRequested="onItemsRequested" |
OnClientDropDownClosing="onDropDownClosing" |
OnItemsRequested="Type_ItemsRequested" |
ShowDropDownOnTextboxClick="false" ShowMoreResultsBox="true" |
Width="100%" meta:resourcekey="Type" /> |
So I replaced with the code block above modifying it to accept case-insensitive search:
function findFirstMatch(comboBox) |
{ |
var text = comboBox.get_text().toLowerCase(); |
if (!text) return null; |
var items = comboBox.get_items(); |
for (var i = 0, length = items.get_count(); i < length; i++) |
{ |
var item = items.getItem(i); |
if (item.get_text().toLowerCase().indexOf(text) >= 0) |
return item; |
} |
} |