Clear search text box when reset button next to search is clicked

Hello Community,

I have a datagrid and I added search option to the datagrid. I have added another button called reset next to search tool. when I click the reset button, I'm able to reset datagrid, but I also want to clear the search input box, how to do that. 


3 Replies

SP Sarveswaran Palani Syncfusion Team July 29, 2022 03:34 PM UTC

Hi Matam,


Greetings from syncfusion support.


We have analyzed your query and suggest you to use the SearchAsync method with an empty string to resolve the problem. Kindly refer the attached code snippet for your reference.


public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)

    {

 

        if (args.Item.Id == "Click")

        {

            await this.DefaultGrid.SearchAsync("");

        }

    }


Please get back to us if you have any further queries


Regards,

Sarveswaran PK



MA Matam replied to Sarveswaran Palani August 8, 2022 10:14 PM UTC

Hi Sarveswaran,

My issues was UI related

I figured it out, I need to add 'StatehasChanged();' in order to show it in the UI as well

Anyway, thank you.

Regards,

Bhramarambika



SP Sarveswaran Palani Syncfusion Team August 9, 2022 01:51 PM UTC

Hi Bhramarambika,


Thanks for your update.


We are happy to hear that your issue has been resolved by you.


Please get back to us if you need further assistance.


Regards,

Sarveswaran PK


Loader.
Up arrow icon