为什么 PostData 值永远不会发送到服务器?如果我使用固定值 postData: {test: "3"} 它可以工作,但是在使用函数时没有任何东西传递给服务器..... Firebug 不会显示任何测试变量的痕迹
$("#tblgrid").jqGrid({
datatype: 'json',
ajaxGridOptions: { contentType: "application/json" },
ajaxRowOptions: { contentType: "application/json", type: "POST" }, //row inline editing
serializeGridData: function(postData) { return JSON.stringify(postData); },
jsonReader: {
repeatitems: false,
id: "0",
cell: "",
root: function(obj) { return obj.d.rows; },
page: function(obj) { return obj.d.page; },
total: function(obj) { return obj.d.total; },
records: function(obj) { return obj.d.records; }
},
url: 'orthofixServices.asmx/GetProductList',
postData: { test: function() { return $("#tid").val(); } },
datatype: 'json',
colNames: ['id', 'Product Description', 'Commission Rate'],
colModel: [
{ name: 'id', width: 50 },
{ name: 'description', index: 'desc', width: 380, editable: true },
{ name: 'commissionrate', index: 'com', width: 120, editable: true, unformat: percentUnFormatter, formatter: percentFormatter, editrules: { number: true} }
],
serializeRowData: function(data) {
var params = new Object();
params.id = 0;
params.prdid = 4;
params.description = data.description;
params.commissionrate = data.commissionrate;
var result = JSON.stringify({ 'passformvalue': params, 'oper': data.oper, 'id': data.id });
return result;
},
mtype: "POST",
rowNum: 4,
width: 500,
height: 80,
pager: '#pager',
editurl: "orthofixServices.asmx/ModifyProductList"
});
$("#tblgrid").jqGrid('navGrid', '#pager', { add: false, edit: false, del: true }, {
//edit options
}, {
//add options
}, {
//delete options
});