SfAutocomplete related issues and need to be solved.

Hi,

I am facing some implementation issues of SfAutocomplete and unable to figure out the solution.
In my project there is a demand of implementation of feature Autocomplete.

The features which I want to implement are :   

1. Available items for selection ( If selected anything, then that one ) strictly from a list. 
    (Please Provide some sample project or code) 

2. If I type some key to search in SfAutocomplete and there is no data available by that particular key. Then by tapping outside of the SfAutocomplete the typed key or string or character ( which has no relevant data in the list) should be removed and will make the typing space of the SfAutocomplete blank.
   (Please Provide some sample project or code) 

3.  How can I fetch the data from some web api and store in the list, which is associated with SfAutocomplete ?
    ( SfAutocomplete will be based on data of a list, which data of the list should be fetched from some web api).
    (Please Provide some sample project or code) 

     Help me and Thanks in advance.


Regards,
Gourav


22 Replies

PA Paul Anderson S Syncfusion Team September 10, 2018 12:49 PM UTC

Hi Gourav, 
 
Thank you for using Syncfusion products. 
 
Query 1 and Query 2: “1. Available items for selection ( If selected anything, then that one ) strictly from a list. ” , ” If I type some key to search in SfAutocomplete and there is no data available by that particular key.” 
 
In our general behavior if we select the item means, that item only displayed from the list. Please check the link for reference to know more information about our SfAutocomplete control 
 
 
For second query you can achieve by using the FocusChangedEvent. Please check the following code snippet for using the FocusChanged Event. In that event you can remove the text which is present in the textbox 
 
<input:SfAutoComplete x:Name="AutoComplete2"                                 
                                  FocusChanged="AutoComplete2_FocusChanged" 
                                  TextColor="Black"> 
 
  private void AutoComplete2_FocusChanged(object sender,                  Syncfusion.SfAutoComplete.XForms.FocusChangedEventArgs e) 
        { 
 
         } 
 
 
Query 3: ” How can I fetch the data from some web api and store in the list, which is associated with SfAutocomplete ? ”. 
 
We have created a sample when using the Web API and accessing into the Autocomplete. Please check the sample from the following link 
 
 
 
Please let us know if you have any other concern. 
 
Regards, 
Paul Anderson 



GR Gourav Roy September 11, 2018 05:21 AM UTC

Hey Paul,
 Thank you so much for the reply. I'm gonna check this out and let you know.

Regards,
Gourav


PA Paul Anderson S Syncfusion Team September 11, 2018 05:32 AM UTC

Hi Gourav, 
  
Thanks for the update. Take your time for trying out and let us know. 
  
Regards, 
Paul Anderson 



GR Gourav Roy September 11, 2018 09:54 AM UTC

Hi Paul,
   
    The project you sent is not compiling.Showing errors.

Regards,
     Sourav

Attachment: SyncfusionACerror_f983ae02.rar


GR Gourav Roy September 11, 2018 12:07 PM UTC

Hi Paul,

Clarification of my Autocomplete 3rd Problem :

    Suppose I have a list of 20000 items ( Medicine). And those item names can be fetched by an ajax call (web api ).
    At the SfAutocomplete the whole list shouldn't be available.
    What the key, user typed in the search box, the related items will be fetched from api and available in the list of SfAutocomplete.

    Suppose the user type "a" then the api gets called automatically and will show all medicine names which contains "a" in the SfAutocomplete list.
    After "a" if the user type another character like "t" and the whole string became "at" and increased in count of character, then the api gets called automatically and will     show   all the medicine names containing "at" in the SfAutocomplete list. 
 
  This is I want to implement in my project.

      Please Help me Paul.


Regards,
Gourav.


PA Paul Anderson S Syncfusion Team September 11, 2018 12:31 PM UTC

Hi Gourav, 
  
Sorry for the inconvenience caused. 
  
We can achieve your requirement of having the Items to be populated in the AutoComplete control based on the text typed by handling the ValueChanged event which will get fired on each letter entered and in that event we can get the Items from the Web API and assign it to the SfAutoComplete's DataSource property. 
  
Regards, 
Paul Anderson 



GR Gourav Roy September 12, 2018 05:08 AM UTC

Hey Paul,
   
        How to configure ValueChanged event (that you mentioned in previous reply) in your provided sample project ?
        You talked that you can, so please configure that in sample project and send me.
          
                                                     Thanking you.
Regards,
Gourav


PA Paul Anderson S Syncfusion Team September 12, 2018 11:18 AM UTC

Hi Gourav, 
  
We have prepared a simple sample for using a ValueChanged Event in which we have added dummy items based on the text typed and  can be populated dynamically in Suggestion list. In that ValueChanged event based on your requirement replace the dummy DataSource with the items getting from the webAPI. Please have the sample from the following link 
  
  
In this sample we have comment the API access line. You need to change your URL code and finally change the DataSource value based on your code. 
  
Please let us know if you have any other concern. 
 
Regards, 
Paul Anderson 



GR Gourav Roy September 13, 2018 04:50 AM UTC

Hey Paul,
               Thank you so much for the reply. I am going to check it and notify you.
 
Regards,
Gourav


GR Gourav Roy September 13, 2018 04:54 AM UTC

Hi Paul,

            How can I show the source list item values without SfAutocomplete Filtering.
            I mean what the list contains after fetching the datas from api will simply show without filtering.

Regards,
Gourav


PA Paul Anderson S Syncfusion Team September 13, 2018 05:33 AM UTC

Hi Gourav, 
  
Thanks for the update. 
  
You can achieve your requirement of having all the items listed without filtering by setting the SuggestionMode as "Custom" and we have to assign our own method to the autocomplete if we need to filter with additional criteria or if not needed just we have to return as true as like below. 
  
autocomplete.Filter = ContainingSpaceFilter;  
public bool ContainingSpaceFilter(string search, object item)  
{ 
    return true; 
} 
 
  
  
  
Please let us know if you have any concerns. 
  
Regards, 
Paul Anderson 



GR Gourav Roy September 13, 2018 07:35 AM UTC

Hey Paul,
       
When I cleared the search field of SfAutocomplete (Means typed some character and deleted), the last suggestion list is still showing.
       Is there anything available to get rid of this issue?
                                      
                                 Thanking You Paul.

Regards,
Gourav


PA Paul Anderson S Syncfusion Team September 13, 2018 09:52 AM UTC

Hi Gourav, 
  
Thanks for the update. 
  
You can achieve your requirement by handling the SelectionChanged event of SfAutoComplete and clear the DataSource of the control as like the below code. 
  
private void autocomplete_SelectionChanged(object sender, Syncfusion.SfAutoComplete.XForms.SelectionChangedEventArgs e) 
        { 
            if(e.Value.Equals("") || e.Value == null) 
            { 
                viewmodel.Products.Clear(); 
            } 
        } 
  
Please let us know if you need further assistance. 
  
Regards, 
Paul Anderson 



GR Gourav Roy September 13, 2018 10:17 AM UTC

Hey Paul,

              I appreciate your quick response. Is there any update of  "token resize" of SfAutocomplete ?
              The Tokens and the Close Sign of tokens are getting hided at the right side of the inner part of autocomplete search box.  
              Any solution of this ?
                                           Thanking you Paul.
Regards,
Gourav 


GR Gourav Roy September 14, 2018 09:12 AM UTC

Hello,

Will Tokens of StAutocomplet be deleted from selected list of SfAutocomplete automatically when I click on the cross sign of token or I have to add custom code to to delete the particular token from list.
help please

Regards,
GOurav


PA Paul Anderson S Syncfusion Team September 14, 2018 10:20 AM UTC

Hi Gourav, 
 
Thanks for the update. 
 
Query 1: “Token resize of SfAutocomplete?” 
 
Token size is set based on the size of the items which set for the Tokens. We don’t have support for resizing the token currently. We have considered this as a feature and logged a feature report and which will be available in any of our upcoming Volume releases. 
 
Query 2: “ The Tokens and the Close Sign of tokens are getting hided at the right side of the inner part of autocomplete search box.” 
 
The items for be scrolled to get the close button visible otherwise you may use the TokenWrapMode is set as wrap for getting all the items. We have prepared a sample for TokenWrapMode is set as Wrap. Please have the sample from the following link 
 
 
Query 3: Will Tokens of StAutocomplet be deleted from selected list of SfAutocomplete automatically 
 
When the SelectedItem of AutoComplete control is binded with TwoWay binding to a list deleting a token will delete the item in the list also. We have prepared a sample for the same and is available in the below link. 
 
 
Please let us know if you have any other concern. 
 
Regards, 
Paul Anderson 



GR Gourav Roy September 15, 2018 09:59 AM UTC

Hey Paul,

     Thank you for sending me the code examples.
     I used TokensWrapMode="Wrap" but still the lengthy tokens are getting hided at right.
      How to solve it. Is there any customization or tricky code available to resolve it ?

Regards,
 Gourav


PA Paul Anderson S Syncfusion Team September 17, 2018 05:46 AM UTC

Hi Gourav, 
  
Sorry for the inconvenicence. 
  
Currently we dont have any workaround or customization to achieve your requirement. We have already considered this as a feature requirement along with Token Resize feature and logged feature report. This feature will be available in any of our upcoming Volume releases. 
  
Regards, 
Paul Anderson 



GR Gourav Roy September 17, 2018 12:57 PM UTC

Hey Paul,

               If I am deleting one token out of three token, there showing "System.NullReferenceException: Object reference not set to an instance of an object.".
               Unable to figure out the actual zone where it getting raised.

Regards,
Gourav

Attachment: Autoooooo_528b5d10.rar


PA Paul Anderson S Syncfusion Team September 18, 2018 07:19 AM UTC

Hi Gourav, 
 
Thanks for contacting Syncfusion support. 
 
We are unable to reproduce the reported issue "NullReferenceException occurs when deleting one token out of three token " from our side. We have prepared a sample with MultiselectMode as Token in SfAutoComplete control and initially binded the selected items from the ViewModel. Please find the sample from the below link. 
 
 
Please check our sample. If the issue persists in your side, please modify our sample to reproduce the reported issue. So that we can give appropriate solution for the reported issue. 
 
Regards, 
Paul Anderson 



RE Rene June 4, 2020 09:15 PM UTC

Except when the letter typed in is a blank, somehow ValueChanged does not fire if just blanks are entered. Is this by design?
I figured I'd rather control this on my end.


RS Ramya Soundar Rajan Syncfusion Team June 5, 2020 10:33 AM UTC

Hi Rene, 
 
Greetings from Syncfusion. 
 
We have checked the reported problem with ValueChanged event but we are unable to reproduce the reported problem at our end. Please find the sample and video for this, 
 
 
 
Could you please check the issue with the attached sample and let us know whether it is reproduced or not in this sample? If the issue was not reproduced in this sample, please revert us by modifying the sample based on your application along with the replication procedure or provide the sample and share the device details, platform details, and Syncfusion NuGet version that you are using in a project. This will be helpful for us to investigate further and provide you a better solution at the earliest.  
 
Regards, 
Ramya S 


Loader.
Up arrow icon