JQGrid with WCF Data Services (OData); loadBeforeSend not called on Edit mode; Cannot do setRequestHeader

前端 未结 1 1943
傲寒
傲寒 2021-01-19 11:39

I am having a bit of a problem with this fantastic jqgrid plugin and my attempt to use it with WCF Data Services (not really, but the very similar odata4j services). By the

相关标签:
1条回答
  • 2021-01-19 11:55

    There are no loadBeforeSend parameter which you can set by $.jgrid.edit. The values from $.jgrid.edit defines default options of editGridRow.

    To specify the loadBeforeSend callback which should be used during the corresponding Ajax request you should use ajaxEditOptions instead and specify beforeSend (see $.ajax):

    $.extend($.jgrid.edit, {
        closeAfterEdit: true,
        closeAfterAdd: true,
        ajaxEditOptions: {
            contentType: "application/json",
            beforeSend: function (jqXHR, settings) {
                jqXHR.setRequestHeader("X-HTTP-Method", "MERGE");
            }
        },
        //mtype: 'POST', - it's already default
        serializeEditData: function (data) {
            delete data.oper;
            return JSON.stringify(data);
        }
    });
    
    0 讨论(0)
提交回复
热议问题