Problem with Select Multiple on datagrid and filtering too #4228
-
Hello, I am not sure if this question has been answered before (I have been through most of the Q&A's that have either of the specific words but I came empty)but, I have a datagrid and I want on a specific column to have a custom made filter. I am using the component as you have also on your documentation but this is the problem that I am facing. I am trying to have a multiple selection like the autocomplete component but I don't want to have a text input and also the filtering is not working when I am selecting one of the entries. <DataGridColumn Field="@nameof(MyClass.MyMethod)" Caption="My Methods" CustomFilter="@OnSelectedMethod">
<FilterTemplate>
<Select TValue="string" SelectedValue="@selectedMethod" SelectedValueChanged="@(value=>{selectedMethod=value;context.TriggerFilterChange(selectedMethod);})" Multiple>
<SelectItem Value="@("*")">All</SelectItem>
<SelectItem Value="@("Email")">Email</SelectItem>
<SelectItem Value="@("Viber/SMS")">Viber/SMS</SelectItem>
<SelectItem Value="@("SMS")">SMS</SelectItem>
</Select>
</FilterTemplate>
</DataGridColumn>
...
@code{
private bool OnSelectedMethod(object itemValue, object searchValue){
if(searchValue is string methodFilter){
return methodFilter == "*" || methodFilter.Contains(itemValue?.ToString());// == itemValue?.ToString();
}
return true;
}} When I am using the multiple and trying to ctrl+click nothing happens on the filtering... I hope to get some suggestions on how to tackle this problem. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You're using the wrong parameters. When |
Beta Was this translation helpful? Give feedback.
You're using the wrong parameters. When
Multiple
is enabled, you must useSelectedValues
andSelectedValuesChanged
.