We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

do not showing data in autoComplete

 <EjsAutoComplete ID="CommerceDrugIderer" @ref="CommerceDrugAutoCompelet" @bind-Value="@SelectedDrug" ShowClearButton="true" SortOrder="Syncfusion.EJ2.Blazor.Lists.SortOrder.Ascending" TValue="string" Placeholder="حداقل سه حرف از نام دارو را وارد کنید" FloatLabelType="FloatLabelType.Auto" DataSource="@CommerceDrugsNameList"  EnableRtl="true">
                   <AutoCompleteEvents TValue="string" ValueChange="OnDrugSelect" Filtering="@CommerceDrugsNameFilter"></AutoCompleteEvents>
                    <AutoCompleteFieldSettings Value="Name"  ></AutoCompleteFieldSettings>
                </EjsAutoComplete>


 public async Task CommerceDrugsNameFilter(Syncfusion.EJ2.Blazor.DropDowns.FilteringEventArgs args)

    {

        
        if (args.Text.Length > 2)
        {
            CommerceDrugsNameList = await http.GetJsonAsync<List<NameId>> ($"api/CommerceDrugsName/GetNameIdByNameFiltering/{args.Text}");
            //CommerceDrugAutoCompelet.DataSource = CommerceDrugsNameList;
            //CommerceDrugAutoCompelet.DataBind();
            CommerceDrugAutoCompelet.Filter(CommerceDrugsNameList);

            u = CommerceDrugsNameList.Count().ToString();
        }
        else if (args.Text.Length == 0)
        {
            args.Cancel = true;
            CommerceDrugsNameList.Clear();
            CommerceDrugsNameList = null;
            //CommerceDrugAutoCompelet.Filter(CommerceDrugsNameList);
            //CommerceDrugAutoCompelet.Clear();
        }
        StateHasChanged();

    }



3 Replies

SD Saranya Dhayalan Syncfusion Team December 6, 2019 09:05 AM UTC

Hi Ebi, 
 
Thank you for contacting Syncfusion support 
 
We have checked your reported issue. Please set args. PreventDefaultAction is true in filtering event. Please remove the Datasource from the component. Please find the following code snippet: 
@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() 
    { 
 
    } 
} 
 
For your convenience we have prepared a sample. Please find the below link: 
 
 
Could you please check the above snippets and get back to us if you need further assistance on this? 
 
Regards, 
Saranya D 



ET ebi torabi December 6, 2019 05:22 PM UTC

Hi Saranya D .Thanks a lot



SD Saranya Dhayalan Syncfusion Team December 9, 2019 04:28 AM UTC

Hi Ebi 
 
Most Welcome.  
 
Please let us know, if you need any further assistance on this.  
 
Regards, 
Saranya D 


Loader.
Up arrow icon