开发者

jqGrid + jQuery 1.4: POST data forcing traditional = true in the ajaxSettings when deleting

开发者 https://www.devze.com 2023-02-17 10:13 出处:网络
I\'ve 开发者_Python百科implemented my beautiful jqGrid with multiselect rows so I can delete more than one row at a time.

I've 开发者_Python百科implemented my beautiful jqGrid with multiselect rows so I can delete more than one row at a time.

I've noticed, though, that my action method doesn't work to well with the parameters received:

<HttpPost()> _
Function Delete(ByVal id As List(Of Int32)) As JsonResult

End Function

When I use the delete function of jqGrid.

If I change my parameter in a string that is fine. I can split the string trying to find the comma (,) and everything works properly. But I would like to work clean ;-)

I've found this POST and it seems that jQuery 1.4 has changed the way it posts array. I remember that I had faced a similar situation with an Ajax call passing arrays and the only thing I had to do was to set the traditional parameter to true. Now, what I can I do to have the same feature in jqGrid?


Delete support ajaxDelOptions parameter which you can use to change options of $.ajax used by jqGrid

$("#myGrid").jqGrid('navGrid', '#pager', {/*navGrid options*/},
    {/*Edit options*/}, {/*Add options*/},
    { // now define settings for Delete dialog
      mtype: "POST", reloadAfterSubmit: false,
      ajaxDelOptions: {traditional: true}
    }
);

Instead of that you can use

$.extend($.jgrid.del, {
    ajaxDelOptions: { traditional: true }
});

to change default options used by jqGrid.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号