We use a custom formatter to output html form text boxes. In the case that a user has entered in data and they hit the next/prev button, we want to tell them "you've edited data, hit ok to stay on this page and save your data". How can you do this?
The 'onPaging' event fires when you use the pager but it doesn't seem to let you prevent the pagination from occuring.
Update: Current workaround:
var currPg = 1;
var dirty = 'false';
$("#list").jqGrid({
...
onPaging: function (b) {
var nextPg = $("#list").getGridParam("page");
if (dirty == 'false') {
currPg = nextPg;
return;
}
$( "#dialog-confirm" ).dialog({
modal: true,
buttons: {
"Stay on current page": function() {
$( this ).dialog( "close" );
},
"Change page": function() {
$( this ).dialog( "close" );
reloadGrid($("#list"), null, nextPg, 'false');
}
}
});
$("#list").setGridParam({page:currPg}); //Workaround - jqGrid still increments the page num even when we return stop so we have to reset it (and track the current page num)
return 'stop';
},