2011-09-17 101 views
0

我一直在試圖弄清楚如何向我的jqGrid添加新記錄時傳遞額外的信息。我已經檢查了herehereherehere只是列舉了一些。幾乎都說同樣的事情。我應該可以使用editData來傳遞其他信息。將額外的數據傳遞給jqGrid

這裏是我添加參數:

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 
     }; 

,我試圖添加的記錄是一個詳細記錄,它有有從報頭中的ID;即header_id。當我檢查發送到Web服務的數據時,我沒有看到任何其他信息。

[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) 

我試着把一個額外的參數放在我的web服務中,但它總是未定義的。我試過只返回一個字符串值,一個沒有獲得的值,它是一樣的。

再次感謝您的幫助和幫助。

回答

0

我想你在代碼中沒有發佈的部分存在問題。我想你在serializeRowData裏使用JSON.stringifyJSON.stringify不執行editData的方法。您應該修改您的實施serializeRowData,如我所述here或最初爲postDatahere

相關問題