AutoComplete's DataBound event not being triggered

Hello,

I'm on version 20.2.0.40. The DataBound event not being triggered for the SfAutoComplete component.

Any ideas or workarounds?


In case it matters, this is how it is configured:

<SfAutoComplete @ref="DestinationsDropDown"
TValue="string"
TItem="BaseItemViewModel"
Placeholder="Select a Destination"
DataSource="@DestinationsList"
Autofill=true
@bind-Value="@CurrentDestination"
Query="@LocalDataQuery"
PopupHeight="130px" EnableVirtualization="true" ShowPopupButton="true">
<AutoCompleteFieldSettings Value="Name" />
<AutoCompleteEvents TItem="BaseItemViewModel" TValue="string"
ValueChange="DestinationsDropDownValueChanged"
Created="DestinationsDropDownCreated"
DataBound="DestinationsDropDownDataBound">
</AutoCompleteEvents>
</SfAutoComplete>



Thanks!



5 Replies 1 reply marked as answer

HO horacioj August 4, 2022 09:54 PM UTC

More info: I'm just trying to use the "Created" and "DataBound" events to call "ShowSpinnerAsync()" and 

"HideSpinnerAsync()".  Is there a better way to accomplish this?



UD UdhayaKumar Duraisamy Syncfusion Team August 5, 2022 12:27 PM UTC

Hi horacioj,


We suggest you use the OnActionComplete event instead of the DataBound event for your requirement. The OnActionComplete will be triggered in the below-mentioned scenarios.


  1. when the data source is populated in the popup list.
  2. When the server request action successfully completed.
  3. When the value is bound initially to the component.


Also, we can call the HideSpinnerAsync and ShowSpinnerAsync using component ref as like in the below code snippet.


@page "/"

@using Syncfusion.Blazor.DropDowns

@using Syncfusion.Blazor.Data

 

<label>Local Data</label>

<SfAutoComplete TItem="GameFields" TValue="string"

DataSource="@Games" PopupHeight="130px"

EnableVirtualization="true"

ShowPopupButton="true"

Placeholder="Select a Destination"

@ref="DestinationsDropDown"

Autofill=true>

    <AutoCompleteEvents TItem="GameFields" TValue="string"

                        OnActionComplete="@OnActionCompleteHandler"

                        Created="@CreatedHandler"></AutoCompleteEvents>

    <AutoCompleteFieldSettings Text="Text" Value="ID"></AutoCompleteFieldSettings>

</SfAutoComplete>

 

@code {

    SfAutoComplete<string, GameFields> DestinationsDropDown;

 

    private async Task OnActionCompleteHandler()

    {

        DestinationsDropDown.HideSpinnerAsync();

    }

 

    private async Task CreatedHandler(Object args)

    {

        DestinationsDropDown.ShowSpinnerAsync();

    }

}


Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorServerApp2141336152


Regards,

Udhaya Kumar D


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Marked as answer

HO horacioj August 5, 2022 12:44 PM UTC

Thank you, Udhaya. It works.

Out of curiosity, shouldn't the DataBound event be working too? Actually, I saw it never being triggered.



UD UdhayaKumar Duraisamy Syncfusion Team August 8, 2022 03:56 PM UTC

Hi horacioj,


We are validating the requirement. We will update the further details in two business days (10th August 2022).


Regards,

Udhaya Kumar D



UD UdhayaKumar Duraisamy Syncfusion Team August 10, 2022 02:54 PM UTC

Hi horacioj,


We will deprecate the DataBound event for the SfAutoComplete component. So, we suggest using the OnActionComplete event instead of the DataBound event for your requirements. As mentioned earlier, the OnActionComplete event is also triggered in the following cases.


  • The data source is populated in the popup list.
  • The server request action was successfully completed.
  • The value is initially bound to the component.



Regards,

Udhaya Kumar D


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Loader.
Up arrow icon