I am trying to use serializeGridData to convert my postdata to JSON using this answer from Oleg. Here is my code.
jQuery(function() {
$('#grid').jqGrid({
........
........
postData: {
param1: function() { return $("param1").val(); },
param2: function() { return $("param2").val(); },
searchText: function() { return $("searchText").val(); },
totalRecords: function() { return msgGrid.getGridParam("records"); }
},
serializeGridData: function (postData) {
return JSON.stringify(postData);
},
ajaxGridOptions : {
contentType: 'application/json; charset=utf-8'
}
});
});
postData coming to serializeGridData does not replace the custom params defined in postData {} with actual values. I have debugged in firebug and this is how the data is coming to serializeGridData method. So eventually JSON.stringify is not converting param1, param2.. values in the request data. How can fix it to send the actual values for custom params? Thanks in advance..
_search false
nd 1349195468864
page 1
rows 25
sidx "sortcol_name"
sord "desc"
param1 function() // expect to have actual param1 value
param2 function()
searchText function()
totalRecords function()