|
<SfComboBox @ref="ComboBoxObj" TItem="GameFields" TValue="string" AllowFiltering="true" Query="@Query"PopupHeight="230px" Placeholder="Select a game" @bind-Value="@DropVal" DataSource="@Games">
<ComboBoxEvents TValue="string" Filtering="OnFiltering"></ComboBoxEvents>
<ComboBoxFieldSettings Text="Text" Value="ID"></ComboBoxFieldSettings>
</SfComboBox>
@code {
public Query Query = new Query().Take(5);
...
public void OnFiltering(FilteringEventArgs args)
{
args.PreventDefaultAction = true;
var query = new Query();
if (args.Text != "")
{
query = new Query().Where(new WhereFilter()
{
Field = "Text",
value = args.Text,
Operator = "startswith",
IgnoreCase = true
});
}
else
{
query = new Query().Take(5);
}
this.ComboBoxObj.Filter(Games, query);
}
}
|