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.
Unfortunately, activation email could not send to your email. Please try again.

Adding Refresh Button To Toolbar

Thread ID:

Created:

Updated:

Platform:

Replies:

113608 Oct 1,2013 02:50 PM Oct 4,2013 08:39 AM ASP.NET MVC (Classic) 1
loading
Tags: Grid
Frank Carr
Asked On October 1, 2013 02:50 PM

Do you have an example of how to add a refresh button, with a graphic, not text, to the Grid toolbar? The button should clear all filters/searches.
 
I suppose this could be done by reloading the entire partial view of the grid but since this seems to be built in on the paging bar I thought there might be a shortcut to doing this.
 

Sandhya D [Syncfusion]
Replied On October 4, 2013 08:39 AM


Hi Frank,

Thanks for your interest in using  syncfusion Products.
Your requirement  to add the toolbar item with  refresh can be achieved by adding the item in ToolBar, In  ClientSideEvents using "onToolbarClickEvent" we can remove the filters and search options while refresh. Please refer the code below.

[view.cshtml]

@(Html.Syncfusion().Grid<Product>("Editings").Datasource(Model)
.Filtering(filter =>
{
 filter.AllowFiltering(true);
 filter.FilterMode(FilterMode.Default);
})
   .AllowSearching(true)
 .Datasource(Model)
                 .Caption("Product Details")
                 .AutoFormat(Skins.Marble)
                 .EnablePaging()
                        .PageSettings(page => { page.PageSize(5).PageCount(5); })
                        .Column(cols =>
                 {
                        cols.Add(c => c.Id).HeaderText(" ID");
                        cols.Add(c => c.Name).HeaderText("Name");
                        cols.Add(c => c.Description).HeaderText("Description");
                        cols.Add(c => c.Quantity).HeaderText("Quantity");


                 })

                 .ClientSideEvents(e => e.OnToolbarClickEvent("OnToolbarClickEvent"))

                 .ToolBar(tools =>
                 {
                    tools.Add(GridToolBarItems.Search);
                    tools.Add("Refresh", "Refresh");

                 })
)


[script ]

<script type="text/javascript">
    var gridObj = null;
    function OnToolbarClickEvent(sender, args) {
        gridObj = sender;
        if ($(args._currentItem).children("a.Refresh").length > 0) {
            gridObj._filters = [];
            gridObj._searchResults = [];
            gridObj.sendRefreshRequest();
        }
       }
</script>
<style>
        .Refresh {
            background-image: url("/Images/111.png");
        }
    </style>

We have attached sample for your reference.Please get back to us if you need further assistance.

Regards,
Sandhya


GridEditing_6908f0f4.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;