Autocomplete event for clicking X

Hi!

Is there an event which is only invoked when the user clicks the X (clear/close) button of the Autocomplete?
Alternatively if there is no separate event for this, is there another event which gets called if the user selects an item or clicks the X?

Thank you for the help!

Attachment: Képernyőfotó_20210408__18.53.42_2e6f3ab.zip

1 Reply 1 reply marked as answer

JC Joseph Christ Nithin Issack Syncfusion Team April 11, 2021 06:05 PM UTC

Hello Kristof, 

   Greetings from Syncfusion support. 

  We have checked your query. There is no separate event for the X (clear/close) button of the Autocomplete. Alternatively the ‘ValueChange’ event triggers when the clear button is clicked. When the event is triggered on clicking the close button the ‘args.ItemData’ will be null with which we can differentiate. Please refer the below code snippet. 



<SfAutoComplete @ref="autoObj" TValue="string" TItem="Order" Query="Query"> 
    <SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" 
    <AutoCompleteFieldSettings Value="CustomerID"></AutoCompleteFieldSettings> 
    <AutoCompleteEvents TValue="string" TItem="Order" ValueChange="OnChange"></AutoCompleteEvents> 
</SfAutoComplete> 
 
@code{ 
   public async Task OnChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, Order> args) 
    { 
        if(args.ItemData == null) 
            { 
               // your code here 
            } 
 
    } 
} 



  Please find the attached sample and kindly revert for more queries regarding this. 

Regards, 
Joseph Christ Nithin I 


Marked as answer
Loader.
Up arrow icon