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 filters in Value instead of Text

Hi,
when using the AutoComplete widget with UserIds (GUID) and DisplayNames, the filter appears to work on the Value instead of the DisplayText - which doesn't make a lot of sense.
Sample: https://syncfusion-autocomplete.stackblitz.io
Editor: https://stackblitz.com/edit/syncfusion-autocomplete

Example record:
"UserName": "admin",
"DisplayName": "Admin",
"Id": "f650c4f8-b8df-44ef-b6a8-866de50af211",
"Email": "admin@example.org"

Type: b68a -> displays "Admin"
Type admi -> displays nothing

A filter only really make sense when - at least by default - filters on the text that is displayed instead of the underlying value. Not sure whether this is a bug or a feature?

3 Replies

PO Prince Oliver Syncfusion Team March 18, 2019 02:06 AM

Hi Stefan, 

Thank you for contacting Syncfusion support. 

This not a bug in our AutoComplete control, this is the intended behavior. By default, EJ2 AutoComplete works only with value field for operations like filtering sorting. If you require to filter using the text field, you can customize using the filtering event in the control. Take a moment to look at the following KB document for further reference on this: https://www.syncfusion.com/kb/10158/why-autocomplete-does-not-filter-using-text-field  

Please let us know if you need any further assistance on this. 

Regards, 
Prince  



ST Stefan March 18, 2019 04:45 AM

Thank you very much.
I'm not sure if that makes sense, but it is now understood.

You may want to update that KB article to show how to reset the search, that took a while to figure out. Like:
     // if text length < minLength, do nothing and reset datasource
            if (e.text.length < e.updateData.length) {
                e.updateData();
                e.cancel = true;
                return false;
            }
            // code to search etc.   


PO Prince Oliver Syncfusion Team March 19, 2019 06:45 AM

Hi Stefan, 

Thank you for your valuable feedback on the KB article. We will consider this in our end and update the content soon. 

Regards, 
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon