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
close icon

Custom Excel Style Grid Toolbar Item to Clear All Filters

I have an Excel Style Grid where every column can be filtered.
How can I create a Custom Toolbar Item to clear all of the filters on the grid and load the default data set?

3 Replies

PS Pavithra Subramaniyam Syncfusion Team February 17, 2017 06:32 AM UTC

Hi Levi, 

We have analyzed your query and we have achieved your requirement by using CustomToolbarItem  property of ToolbarSettings and we  can clear the filtering using clearFiltering method of ejGrid control. Actions for this customized toolbar is defined in ToolbarClick event. Please refer the following code snippet, online document link and sample link . 
 
<ej:Grid ID="OrdersGrid" runat="server" AllowFiltering="True" AllowPaging="True" > 
<FilterSettings FilterType="Excel" />  
       <ClientSideEvents ToolbarClick="onToolBarClick" /> 
       <EditSettings AllowAdding="True" AllowDeleting="True" AllowEditing="True"></EditSettings> 
       <ToolbarSettings ShowToolbar="True"> 
                    <CustomToolbarItem> 
                        <ej:CustomToolbarItem Text="clearFilter" /> 
                    </CustomToolbarItem> 
       </ToolbarSettings> 
       <Columns> 
                  . . . 
       </Columns> 
</ej:Grid> 
    . . . 
<script type="text/javascript"> 
            function onToolBarClick(sender) { 
                if (sender.itemName == "clearFilter") 
                    this.clearFiltering(); 
            } 
</script> 
 
                                            2. https://help.syncfusion.com/api/js/ejgrid#methods:clearfiltering 
 
 
Regards, 
Pavithra S. 



LL Levi Leonards February 21, 2017 09:23 PM UTC

Perfect example, thanks!


PS Pavithra Subramaniyam Syncfusion Team February 22, 2017 05:10 AM UTC

Hi Levi, 
 
Thanks for your update.           
We are happy that the provided information helped you. 
 
Regards, 
Pavithra S. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon