How to handle BACKSPACE presses when EnableLoadOnDemand and MarkFirstMatch are 'true'
Article Info
Rating: Not rated
|
Article relates to
|
RadComboBox for ASP.NET AJAX
|
|
Created by
|
Simon, Telerik
|
|
Last modified by
|
Simon, Telerik
|
HOW TO
Handle BACKSPACE presses in RadComboBox working in Load On Demand and with
MarkFirstMatch set to
true.
DESCRIPTION
By default, RadComboBox does handle this case. In some cases, when BACKSPACE is pressed, the last letter of the user-typed text should be deleted and Items should be filtered with the new text. This default behaviour can be seen
here.
SOLUTION
Handle the
OnClientItemsRequesting and
OnClientKeyPressing events as shown below:
| var queryText = ""; |
| |
| function clientItemsRequesting(sender, eventArgs) |
| { |
| queryText = eventArgs.get_text(); |
| } |
| |
| function clientKeyPressing(sender, eventArgs) |
| { |
| if (eventArgs.get_domEvent().keyCode == 8) |
| { |
| var newText = queryText.substring(0, queryText.length); |
| |
| sender.set_text(unescape(newText)); |
| } |
| } |
Comments
There are no comments yet.
If you'd like to comment on this KB
article, please, send us a
Support Ticket.
Thank you!
Please
Sign In
to rate this article.