We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

AutoComplete with UrlAdaptor returns longer-running requests last, causing the result set to be wrong.

I'm very new to Syncfusion, so I find myself sort of stuck on this particular issue.

I have a method in the controller of my view that provides the datasource for my Autocomplete control. When I start typing, it queries this method, which in terms queries a remote API that gives me back a list of games. I have the min length of the Autocomplete control set to 3.

The situation is as such: If I want to look for, let's say "God of War", and I type it in, it sends a request to my controller for every new keypress. As such, the results for the filter "God" take longer to complete than for "God of War", causing the the result of the latter to arrive before the former. This ultimately causes the wrong result set to be displayed: Instead of all God of War games, I get all games containing the word God or whatever.

How can I make it so the correct data (the result of only the most recent request) is displayed, instead of the result of the request that takes the longest?

Thanks in advance. I've attached some relevant files.

Attachment: source_77f879ea.rar

1 Reply

SP Sureshkumar P Syncfusion Team May 2, 2023 12:06 PM UTC

Hi Tom,

We suggest you use the filterType property value as startswith instead of contains to achieve your requirement. To know more about the filter type, please refer to the documentation.

Documentation here: https://ej2.syncfusion.com/aspnetcore/documentation/auto-complete/filtering#change-the-filter-type


Sureshkumar P

Live Chat Icon For mobile
Up arrow icon