I want to write code on Refresh button click of JQGrid. Is there any event for that?
Refresh is used reload jQgrid table data, sometimes table is not refresh on action that time you need to refresh table data manually. jQgrid provide refresh: true property that enable to add refresh icon into footer of jQgrid table.You need to add this property into pager jqgrid instance.
here you will get all your posted data in console.log (). Delete record is another common functionality in grid listing.You need to add delete call-back function into jQgrid instance and pass parameters like delete window header, send request on ENTER button clicked etc. //delete Options. save key parameter will keybind the Enter key to submit.
first we will add a New record, Edit and Delete button into jQgrid table, we need to add 'true' property of add, edit, delete option which are associated with jQgrid instance, Change false to true property that will show add,edit and delete button into footer of jQgrid table, after required changes the previous code will become like below,
There are a lot of advanced option available in jQgrid plugin, you can explore more jQgrid features as per you requirement. You can download source code and Demo from below link. Please support us, use one of the buttons below to unlock the content.
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!');
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With