Completed
Last Updated: 11 Jun 2020 06:30 by ADMIN
IneqeDevTeam
Created on: 09 Jun 2020 09:52
Category: MultiSelect
Type: Feature Request
1
Support for programatically adding and removing from Multiselect

Hi

Recently we were building a feature that allows the optional selection of multiple items, and decided to use the Telerik Multiselect component. A subcomponent of the feature reads from a file, and pre-selects items in the multiselect based on data in the file similarly to this sample:

foreach(string item in file)
{
    selectedItemsList.Add(item);
}

At the moment, however, it seems that the Telerik Multiselect does not refresh its state when selected items are added and removed programatically, only when they are added or removed via user interaction. Would it be possible to have the Telerik Multiselect support the usage of ObservableCollection?

Thanks in advance!

Michael

 

1 comment
ADMIN
Svetoslav Dimitrov
Posted on: 11 Jun 2020 06:30

Hello,

You can programmatically preselect items for our Multiselect as you can see from the example here: https://docs.telerik.com/blazor-ui/components/multiselect/overview#examples. The condition for that to be true is that the items you want to pre-select must be in the data source bound to the Data parameter. If they are not, you should add them and after that - select them. As with any other parameter that is not a value type, you must provide a new reference for the framework to update the component.

Regards,
Svetoslav Dimitrov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.