I am triggering jqgrid reload on button click and also resetting the page value to '1' for my pagination to work correctly. But jqgrid submits the value present in the grid(if on 2nd page it sends a value of '2) and it also sends some additional parameters which were part of previous search. How can I avoid that please?
$('#delete').click(function() {
var rowIds = msgGrid.jqGrid('getGridParam','selarrrow');
$('#grid').setGridParam({url:'delete.html?rowIds=' + rowIds,
page: '1'
});
$('#userGrid').trigger("reloadGrid");
});
jQuery(function() {
jQuery("#grid").jqGrid({
url:'page.html',
datatype: 'json',
mtype: 'POST',
.....
postData: {
totalRecords: function() { return $('#grid').getGridParam("records"); }
},
rowNum: 25,
.....
});
});
When the grid is first loaded my url is page.html, but when user selects some rows and clicks delete, I am changing the url to delete.html with selected rows. The delete functionality deletes the selected rows and sends the latest data back to grid. Now if I click on refresh, it is still going to delete.html as my url is not changed. Also if user selects few rows before refresh, the selected rows data get deleted as the url is not changed...