Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148960 | Nov 8,2019 09:49 PM UTC | Nov 11,2019 01:16 PM UTC | Blazor | 1 |
![]() |
Tags: ComboBox |
<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> |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.