hetal gala
hetal gala

Reputation: 249

JQgrid on refresh button click

I want to write code on Refresh button click of JQGrid. Is there any event for that?

Upvotes: 5

Views: 16680

Answers (2)

Oleg
Oleg

Reputation: 221997

If you need to do some actions before refresh will be started you should use beforeRefresh callback:

$("#grid_id").jqGrid('navGrid', '#gridpager', {
    beforeRefresh: function () {
        // some code here
    }
});

If you need absolute another implementation of grid Refreshing where you will not call $("#grid_id").trigger("reloadGrid"); (which sound strange) you can do this by the usage of refresh: false option to remove the standard Refresh button and using navButtonAdd to add your custom button which looks exactly like the original one:

$("#grid_id").jqGrid('navGrid', '#gridpager', {refresh: false});
$("#grid_id").jqGrid('navButtonAdd', "#gridpager", {
     caption: "", title: "Reload Grid", buttonicon: "ui-icon-refresh",
     onClickButton: function () {
         alert('"Refresh" button is clicked!');
     }
});

Upvotes: 18

user1357679
user1357679

Reputation:

The css for refresh button is ui-icon-refresh

so you can write your custom code on this css like

jQuery('.ui-icon-refresh').click(function(){
  // do your work
});

Upvotes: 0

Related Questions