<EjsComboBox TValue="string" @ref="comboObj" Placeholder="Select a game" DataSource="@Games" AllowFiltering="true">
<ComboBoxEvents TValue="string" Filtering="OnFilter"></ComboBoxEvents>
<ComboBoxFieldSettings Value="text"></ComboBoxFieldSettings>
</EjsComboBox>
@code{
EjsComboBox<string> comboObj;
public void OnFilter(FilteringEventArgs args)
{
args.PreventDefaultAction = true;
var query = "new ej.data.Query().select(['text', 'id']).where('text', 'contains', '" + args.Text + "', true)";
comboObj.Filter(Games, query);
}
public class GameFields
{
public string id { get; set; }
public string text { get; set; }
}
List<GameFields> Games = new List<GameFields>()
{
new GameFields(){ id= "Game1", text= "American Football" },
new GameFields(){ id= "Game2", text= "Badminton" },
new GameFields(){ id= "Game3", text= "Basketball" },
new GameFields(){ id= "Game4", text= "Cricket" }
};
} |
<EjsComboBox TValue="string" @ref="comboObj" Placeholder="Select a game" FilterType="Syncfusion.EJ2.Blazor.DropDowns.FilterType.Contains" DataSource="@Games" AllowFiltering="true">
<ComboBoxEvents TValue="string" Filtering="OnFilter"></ComboBoxEvents>
<ComboBoxFieldSettings Value="text"></ComboBoxFieldSettings>
</EjsComboBox> |
In my case, FilterType="FilterType.Contains" is exactly what I was looking for. Nice work out there Team Syncfusion. 👍
Hi Mike,
We are glad that your requirement has been fulfilled on your end. We are always happy to assist you.
Regards,
Udhaya Kumar D