This is a migrated thread and some comments may be shown as answers.

RadAutoCompleteBox filter callback misses letters that are entered after it sends the callback for first letter.

3 Answers 164 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Jameson
Top achievements
Rank 1
Jameson asked on 24 Aug 2016, 02:28 AM

RadAutoCompleteBox comes back with the wrong filtered result set when typing into the textbox. It seems to be doing the filtering on the first letter I'm typing, but then ignoring the second letter I've typed. For example, if I start to type the word "test" it will start filtering the auto complete box for "t" or "te", but ignore the rest of the word. It seems to be doing the filtering if i very briefly pause (split second) and that's why it's not picking up the whole word. If I hit backspace, then it does a callback and the filtered result set is accurate. Is there a built in way to delay the filtering so it only does the callback after I've stopped typing for one second? Thanks in advance for the help.

 

Here's the code:

<telerik:radautocompletebox id="txtSearch" runat="server" oncliententryadding="OnClientEntryAddingHandler" emptymessage="FIND AN ACCOUNT or TPID"
                                    autopostback="true" onentryadded="autocomplete_EntryAdded" filter="Contains" datavaluefield="TPID" datatextfield="AccountName" 
                                    cssclass="searchtext" width="275px" DropDownAutoWidth="Enabled" maxresultcount="10">
                            </telerik:radautocompletebox>

3 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Danchev
Telerik team
answered on 26 Aug 2016, 12:12 PM
Hello Jameson,

If you want to delay the filtering you can consider using one of the two approaches explained below or both:

1. The search can be prevented until the user enters the required number of characters by setting the MinFilterLength property (for instance MinFilterLength="3"). Using your example, the user would have to enter "tes" in order for the search to be initiated.
2. The search can be delayed. You can subscribe the AutoCompleteBox to its OnClientLoad event (OnClientLoad="OnClientLoad") and in its handler set a delay in milliseconds:
function OnClientLoad(sender) {
    sender.set_requestDelay(1000);
}

set_requestDelay() and other important client-side methods are listed in the following documentation article.

Regards,
Ivan Danchev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Jameson
Top achievements
Rank 1
answered on 26 Aug 2016, 05:37 PM
Thank you for your help! This works great. I was trying to use the set_requestDelay(), but was putting it in the wrong event - OnClientEntryAdding.
0
Ivan Danchev
Telerik team
answered on 29 Aug 2016, 10:32 AM
Hello Jameson,

I am glad it worked out. The OnClientLoad event handler is the right place to call the method, because the OnClientEntryAdding event fires after the request is sent.

Regards,
Ivan Danchev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
AutoCompleteBox
Asked by
Jameson
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Jameson
Top achievements
Rank 1
Share this question
or