In general you can use data
property of ajaxSelectOptions
. The code cam look like
ajaxSelectOptions: {
type: "POST",
data: {
action: "popCodeAdjust";
}
}
or
ajaxSelectOptions: {
type: "POST",
data: {
action: function () {
return "popCodeAdjust";
}
}
}
See here or here.
The problem can be if you really need to send the data in JSON format. In the case you can need either to serialize the value of the parameter data (like JSON.stringify({action: actionValue})
) or the value with parameter name (like action: JSON.stringify(actionValue)
). See the answer which role play BodyStyle
attribute (WebMessageBodyStyle.Wrapped
, WebMessageBodyStyle.WrappedResponse
etc) in WCF method in the case.
In jqGrid 4.4.2 or higher (see the answer, my pull request and the fix) you can use postData
as function. You can define it either inside of 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")});
}
}
You can specify postData
alternatively inside of editoptions
(see here).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…