MultiSelect Events
This article explains the events available in the Telerik MultiSelect for Blazor:
OnBlur
The OnBlur event fires when the component loses focus.
Handle the OnBlur event
OnChange
The OnChange event represents a user action - confirmation of the current value/item. The key differences with ValueChanged are:
OnChangedoes not prevent two-way binding (the@bind-Valuesyntax)OnChangefires when the user pressesEnterin the input, or blurs the input (for example, clicks outside of the input or dropdown).
OnChange fires when an item is selected from the dropdown, an item is removed from the selected list, or all items are removed from the selected list, just like ValueChanged.
Handle OnChange
OnClose
The OnClose event fires before the MultiSelect popup closes.
The event handler receives as an argument an MultiSelectCloseEventArgs object that contains:
| Property | Description |
|---|---|
IsCancelled | Set the IsCancelled property to true to cancel the closing of the popup. |
OnItemRender
The OnItemRender event fires when each item in the MultiSelect dropdown renders.
The event handler receives as an argument an MultiSelectItemRenderEventArgs<TItem> object that contains:
| Property | Description |
|---|---|
Item | The current item that renders in the MultiSelect. |
Class | The custom CSS class that will be added to the item. |
OnOpen
The OnOpen event fires before the MultiSelect popup renders.
The event handler receives as an argument an MultiSelectOpenEventArgs object that contains:
| Property | Description |
|---|---|
IsCancelled | Set the IsCancelled property to true to cancel the opening of the popup. |
OnRead
You can use the he OnRead event to provide data to the component according to some custom logic and according to the current user input and/or scroll position (for virtualization). The event fires when:
- The component initializes.
- The user filters.
- The user scrolls with virtualization enabled.
You can also call remote data through async operations.
Find out how to get the applied filtering and grouping criteria.
Custom Data according to the user input in the MultiSelect
Filter large local data through the Telerik DataSource extensions
OnSelectAll
The MultiSelect OnSelectAll event fires when the user clicks on the Select All toggle button in the dropdown. The event handler receives a generic MultiSelectSelectAllEventArgs<TItem> argument with an Items property that exposes the currently rendered items in the dropdown. These items may be subject to selection or deselection, depending on the current MultiSelect Value and the Select All toggle button state. OnSelectAll fires before ValueChanged.
Using OnSelectAll requires the MultiSelect EnableSelectAll parameter value to be true.
Using the MultiSelect OnSelectAll event
ValueChanged
The ValueChanged event fires when the user selection changes (the user adds or removes items). The type of the argument in the lambda expression must match the Value type of the component.
ValueChanged fires after OnSelectAll.
If
AdaptiveRenderingis enabled, on small and medium devicesValueChangedfires only when the user clicks the confirmation button in the action sheet.
Handle MultiSelect ValueChanged
The event is an
EventCallback. It can be synchronous and returnvoid, or asynchronous and returnasync Task. Do not useasync void.
The lambda expression in the handler is required by the framework: https://github.com/aspnet/AspNetCore/issues/12226.