Below is my jqGrid initialisation:
jQuery("#dataGrid").jqGrid({
jsonReader : {
root:"rows",
page: "page",
total: "total",
records: "records",
cell: "",
id: "0"
},
postData: {
page: function() { return page; }
},
url: 'WebService.asmx/GetData',
datatype: "json",
mtype: "POST",
ajaxGridOptions: {
contentType: "application/json; charset=utf-8"
},
serializeGridData: function (data) {
return JSON.stringify(data);
},
colNames: [<%= colName %>],
colModel: [<%= colModal %>],
rowNum: 10,
rowList: [10, 20, 30],
pager: '#dataGrid_Pager',
sortname: 'name',
viewrecords: true,
sortorder: "name",
caption: "JSON Example"
});
There is no problem displaying the data on the grid. However, in my web service the postData is empty. i.e. context.request.form(0) is empty.
When I removed this from the code:
ajaxGridOptions: {
contentType: "application/json; charset=utf-8"
},
postData contains this when I add a watch to context.request.form(0):
{"page":1,"_search":false,"nd":1394031676148,"rows":10,"sidx":"name","sord":"name"}
But now, the grid is empty with no grid data.
Seems like postData is conflicting with the ajaxGridOptions?
Anyone can advise? I need both of them to work together.
Thanks!