Hi Phúc,
Thank you for reaching out to Syncfusion
Support.
We have checked the reported query, and
you can utilize the FilterAsync
method of the listbox to filter its data based on the query provided. Please
refer to the below code snippets and samples.
|
<SfTextBox
Input="@InputHandler"></SfTextBox>
<SfListBox
TValue="string[]" @ref="ListBoxObj"
DataSource="@CountryData" TItem="CountryCode">
<ListBoxFieldSettings Text="Name" Value="Code"
/>
</SfListBox>
@code {
SfListBox<string[], CountryCode> ListBoxObj;
private async void InputHandler(InputEventArgs args)
{
var query = new
Query().Where(new WhereFilter() { Field = "Name", value =
args.Value, Operator = "StartsWith", IgnoreAccent = true,
IgnoreCase = true });
query =
!string.IsNullOrEmpty(args.Value) ? query : new Query();
await
ListBoxObj.FilterAsync(ListBoxObj.DataSource, query);
}
}
|
Sample Link: https://blazorplayground.syncfusion.com/BjLfjxiKnDgxUPCb
Please let us know if you need any further
assistance on this.
Regards,
KeerthiKaran K V