Passing extra data to jqGrid
I've been trying to figure out how to pass additional information when adding a new record to my jqGrid. I've checked here, here, here, and here just to list a few. All pretty much say the same thing. I should be able to use editData to pass additional info.
Here are my add parameters:
addSettings = { recreateForm: true, width: 400, mtype: "POST", jqModal: true, reloadAfterSubmit: false, savekey: [true, 13], closeOnEscape: true, closeAfterAdd: true, editData: { SomeExtraData: function () { return $('#header_id').val(); } }, onclickSubmit: onclickSubmitLocal };
The record that I'm trying to add is a detail record and it has to have the id from the header; ie header_id. When I check the data that is being sent to the web service I don't see any addit开发者_开发技巧ional information.
[WebInvoke(Method = "POST", UriTemplate = "/Save/AddDetail", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public string AddDetail(string Id, string Step_Number, string Step_Description, string oper, string id)
I've tried putting an additional parameter in my web service but it always is undefined. I've tried returning just a string value, one that isn't obtained, and it's the same thing.
Thank you again for any help and assistance.
I suppose that you have the problem in the part of your code which you don't posted here. I suppose that you use JSON.stringify
inside of serializeRowData
. The JSON.stringify
don't execute methods of editData
. Se you should modify your implementation of serializeRowData
like I described here or originally for the postData
here.
精彩评论