I use TelerikMultiSelect as a component for custom filter:
<FilterMenuTemplate>
<TelerikMultiSelect Value="@(AlreadySelectedFilterValues(context.FilterDescriptor))"
OnRead="@OnReadWrapper"
ValueMapper="@ValueMapperWrapper"
TItem="@FilterItemDto"
TValue="@TFilterValue"
ValueField="@nameof(FilterItemDto.Id)"
TextField="@nameof(FilterItemDto.Name)"
AutoClose="true"
Filterable="true"
ClearButton="true"
DebounceDelay="500"
OnChange="@((object newValue) => OnMenuFilterChange(newValue, context))"/>
</FilterMenuTemplate>
Trying to render already selected filters gives two "magic" items in context.FilterDescriptor in AlreadySelectedFilterValues:
These items appear only if TelerikMultiSelect is empty. If I select some from MultySelect these two items disappear and everything works as expected.
GridState has an empty list of FilterDescriptos.
AggregatedAccountNames - string? column.
TFilterValues can be int, int? or string, no matter, the same behavior.
TFilterItemDto - class with int? Id and and string Name fields.
As expected value I expect to have empty FilterDescriptos if nothing was selected.