通常,您可以使用ajaxSelectOptions的data属性.代码凸轮看起来像
ajaxSelectOptions: {
type: "POST",
data: {
action: "popCodeAdjust";
}
}
要么
ajaxSelectOptions: {
type: "POST",
data: {
action: function () {
return "popCodeAdjust";
}
}
}
问题可能在于您确实需要以JSON格式发送数据.在这种情况下,您可能需要序列化参数数据的值(如JSON.stringify({action:actionValue}))或带参数名称的值(如action:JSON.stringify(actionValue)).在WCF方法中,参见the answer哪个角色扮演BodyStyle属性(WebMessageBodyStyle.Wrapped,WebMessageBodyStyle.WrappedResponse等).
在jqGrid 4.4.2或更高版本(参见the answer,my pull request和the fix)中,您可以使用postData作为函数.您可以在ajaxSelectOptions中定义它
ajaxSelectOptions: {
contentType: "application/json",
dataType: "json",
type: "POST",
postData: function (rowid, value, name) {
return JSON.stringify({action: "popCodeAdjust"});
//or depend on the relinquishment of the server side
//return {action: JSON.stringify("popCodeAdjust")});
}
}
您可以在editoptions中指定postData(参见here).