@using Syncfusion.EJ2.Blazor.DropDowns;
@using BlazorApp1.Data;
@inject WeatherForecastService ForecastService
<EjsAutoComplete ID="CommerceDrugIderer" @ref="CommerceDrugAutoCompelet" @bind-Value="@SelectedDrug" ShowClearButton="true" SortOrder="Syncfusion.EJ2.Blazor.Lists.SortOrder.Ascending" TValue="string" Placeholder="حداقل سه حرف از نام دارو را وارد کنید" EnableRtl="true">
<AutoCompleteEvents TValue="string" ValueChange="OnDrugSelect" Filtering="@CommerceDrugsNameFilter"></AutoCompleteEvents>
<AutoCompleteFieldSettings Value="CommerceDrugsId" Text="CommerceDrugsName"></AutoCompleteFieldSettings>
</EjsAutoComplete>
@code{
EjsAutoComplete<string> CommerceDrugAutoCompelet;
private List<NameId> CommerceDrugsNameList = null;
public string SelectedDrug { get; set; }
public async Task CommerceDrugsNameFilter(Syncfusion.EJ2.Blazor.DropDowns.FilteringEventArgs args)
{
if (args.Text.Length > 2)
{
args.PreventDefaultAction = true;
CommerceDrugAutoCompelet.Filter(await ForecastService.getData());
var u = CommerceDrugsNameList.Count().ToString();
}
else if (args.Text.Length == 0)
{
args.Cancel = true;
CommerceDrugsNameList.Clear();
CommerceDrugsNameList = null;
}
}
public void OnDrugSelect()
{
}
} |