This is a migrated thread and some comments may be shown as answers.

How to maintain input text, whilst updating ItemsSource data MVVM?

3 Answers 63 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Maurice
Top achievements
Rank 1
Maurice asked on 20 Sep 2019, 08:14 AM

Hi Telerik Team,

I suspect this is not using the ComboBox as intended and the AutoComplete behaves in a similar manner as it appears both controls expect all the data to be loaded and the filtering is down within the control on the superset of data.

However, I have a massive dataset and I want to use this as a traditional AutoComplete/Suggest control, so I am loading in all the (pre-filtered) data as the user types, the issue is as soon as I update the ItemsSource and there is 1 item that is a substring match (am using Contains) the control selects that item and clears the input text from the user.

Is there a way I can accept all user input without it being cleared until the user picks an item from the dropdown? Moreover, is it possible to not change the SelectedItem binding until a dropdown item is chosen "by the user" (not by the control)?

Thanks,
Maurice

3 Answers, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 24 Sep 2019, 12:01 PM

Hello Maurice,

Thank you for the provided information.

I will address your questions in order:

Is there a way I can accept all user input without it being cleared until the user picks an item from the dropdown?

Can you elaborate a bit on the described scenario? How are you loading in all the (pre-filtered) data? Are you using a custom Filtering Behavior? Also can you share what you mean by the "the control selects that item and clears the input text from the user"? You can provide some sample code to better illustrate the scenario.

Moreover, is it possible to not change the SelectedItem binding until a dropdown item is chosen "by the user" (not by the control)?

You can control this behavior with the CanAutocompleteSelectItems property of the RadComboBox. It determines, if the autocomplete feature can select the autocompleted item. 

I am looking forward to your reply.

Regards,
Vladimir Stoyanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Maurice
Top achievements
Rank 1
answered on 24 Sep 2019, 10:47 PM

Hi Vladimir,

The data is filtered server-side (REST request) as the user types. Updating the ItemsSource property as the user types clears the user input.

Regards,
Maurice

0
Vladimir Stoyanov
Telerik team
answered on 27 Sep 2019, 03:11 PM

Hello Maurice,

Thank you for the additional information. 

I tested the described scenario, however I was not able to reproduce this behavior on my end. That is why I am attaching the sample project, which I used for testing purposes. On my end updating the ItemsSource while typing does not clear the Text. I have also added a video demonstrating my tests(you can drag&drop it in Internet Explorer in order to watch it).

Please, check out the sample project and see how it differs from the setup on your end. If possible, I would ask you to modify it in order to replicate the same result and send it over in a new support ticket (since projects cannot be attached to forum posts). This way I will be able to investigate the scenario and better assist you.

Thank you in advance for any help you can provide.

Regards,
Vladimir Stoyanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ComboBox
Asked by
Maurice
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Maurice
Top achievements
Rank 1
Share this question
or