Google Place Autocomplete issues

Hi,

I try to setup the google place autocomplete results in the sfautocomplete control. 

It works well when the results are fitting well to the datasource provided.

My issue is that google is providing some closer results and it doesn't appear in the filter suggestion box.

I setup: IgnoreDiacritic="true" AutoCompleteMode="Suggest" SuggestionMode="Contains" MinimumPrefixCharacters="4"

But some results I got form google don't appear in the suggestion box because the text value don't fit the algorithms in the source code of the sfautocomplete.

Is there a way to provide a datasource and the text box independently. I provide the results everytime the text changes. I don't need the suggestion contains or other because my api returns the values.

Can you help on this?

Thanks,

3 Replies 1 reply marked as answer

SP Sakthivel Palaniyappan Syncfusion Team June 15, 2020 01:39 PM UTC

Hi Alexis,

Greetings from Syncfusion.

We would like to inform that you can use SuggestionMode as Custom to achieve your requirement. Please find the below code snippet to show Suggestion when setting SuggestionMode as Custom.  

Code Snippet:
 
 
autoComplete.Filter = ContainingSpaceFilter;

 public bool ContainingSpaceFilter(string search, object item)
  
        {  
            string text = item.ToString().ToLower();  
            if (item != null)  
            {  
                if (!search.Contains("."))  
                {  
                    search = search.Insert(0, ".");  
                }  
  
                if (text.StartsWith(search.ToLower()))  
                {  
                    return true;  
                }  
            }  
  
            return false;  
        }  

We have modified the sample based on this and please find the sample from below link 

Sample:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/AutoComplete_Custom-1833235068.zip 

Please refer the below link for this 

UG Link: 
https://help.syncfusion.com/xamarin/autocomplete/autocomplete-filtering-options

Please check with the above UG link and use the SuggestionMode as per your requirement. 

Please check with the above sample and if your requirement is different from this  please provide the additional information about your requirement which will be helpful for us to provide the solution at the earliest.

Regards,
Sakthivel P.
 


Marked as answer

AL Alexis June 15, 2020 01:54 PM UTC

Hi,

Thanks for your help.

I finally decided to use a combobox with AllowFiltering=false

Thanks,


SP Sakthivel Palaniyappan Syncfusion Team June 16, 2020 08:37 AM UTC

Hi Alexis,

Thanks for the update.

Please let us know if you need any further assistance.

Regards,
Sakthivel P.
 


Loader.
Up arrow icon