AutoComplete -- CompletionMode="Contains" not working

4 posts, 0 answers
  1. Sheldon
    Sheldon avatar
    1 posts
    Member since:
    Aug 2017

    Posted 06 Nov 2017 Link to this post

    For the RadAutoComplete control for Xamarin (release 2017.3.1103.4), I have tried setting the CompletionMode property both in markup and the code-behind, but the typeahead always behaves as though "StarsWith" was the value instead of "Contains."

     

    Is this a bug in the current release?

  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    595 posts

    Posted 08 Nov 2017 Link to this post

    Hi, Sheldon,

    I could not reproduce this behavior in any of the platforms. I have used the GettingStarted example from the SDK Samples Browser(available in the Examples folder of your local Telerik UI for Xamarin installation). Here is the code:

    var autoComplete = new RadAutoComplete { Watermark = "Search here..." };
    autoComplete.CompletionMode = Telerik.XamarinForms.Input.AutoComplete.CompletionMode.Contains;
    // << autocomplete-getting-started-csharp
     
    autoComplete.ItemsSource = new List<string>()
    {
        "Freda Curtis",
        "Jeffery Francis",
        "Eva Lawson",
        "Emmett Santos",
        "Theresa Bryan",
        "Jenny Fuller",
        "Terrell Norris",
        "Eric Wheeler",
        "Julius Clayton",
        "Alfredo Thornton",
        "Roberto Romero",
        "Orlando Mathis",
        "Eduardo Thomas",
        "Harry Douglas"
    };
     
    var panel = new StackLayout();
    panel.Children.Add(autoComplete);
    this.Content = panel;

    The behavior works as expected. Please provide more information on your setup. You can try rebuilding your example after changing the CompletionMode and testing.

    Regards,
    Stefan Nenchev
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. sandeep
    sandeep avatar
    3 posts
    Member since:
    Nov 2017

    Posted 18 Dec 2017 in reply to Stefan Nenchev Link to this post

    Hello,

    I am facing the same problem. If i am giving static data as in the example it's working fine.

    But when I get the data after a Rest call and then assign the data back to the control, then the completionmode is not working.

    Please help.

    public async void setupUI() {
                if (!vm.patientList.Any())
                {
                    DependencyService.Get<IUtil>().showProgressHUD(AppResources.kGCSDownload);
                    //fetch patients only once, then we can use the in memory model
                    // if we want to fetch again, we will tap the sync button on the Toolbar

                        await Task.Run(async () =>
                        {
                            await vm.FetchPatientsAsync();
                        });
                    DependencyService.Get<IUtil>().hideProgresHUD();
                }

                searchBox.TextSearchPath = "Name";
                searchBox.CompletionMode = Telerik.XamarinForms.Input.AutoComplete.CompletionMode.Contains;
                searchBox.ItemsSource = vm.patientList;
                
            }

    I can also see that if I put the ItemsSource = vm.patientList before searchBox.TextSearchPath = "Name";

    The search will display the model class like this PatientInfo and not the actual PatientInfo.Name, but if i give it after then it's working fine.

    Thanks,

    Sandeep

  4. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    595 posts

    Posted 19 Dec 2017 Link to this post

    Hi, Sandeep,

    Can you please test the behavior with the latest minor release - 2017.3.1214 - as we have applied a fix for the following issue - AutoComplete: [Android]Changing the ItemsSource causes the CompletionMode to always be StartsWith. Furthermore, we have fixed the following issue as well - AutoComplete: ObservableCollection notification changes are not respected. With this in mind, you can try to use an ObservableCollection to store your items and clear/fill it with items when you need to.

    I hope the information will be useful and will resolve the issues at your end.

    Regards,
    Stefan Nenchev
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top