Set Url on loadBeforeSend in jqGrid

后端 未结 2 2016
走了就别回头了
走了就别回头了 2021-01-21 07:51

I have a wcf service for a large number of reports that returns json data to my jqgrid. Everything works as expected. However, due to the large number of user inputs for each r

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-21 08:20

    If you use mtype: 'GET' and neew just to set additional parameters which will be appended to URL you can use postData parameter of jqGrid. The best results you will have if define the postData as a function (see here for details).

    One more way is to use beforeRequest where this will be set to the grid DOM element and you can access (and change if needed) the url parameter of jqGrid per this.p.url. You can of course use $(this).jqGrid('setGridParam','url',yourNewUrl); instead of direct changing of this.p.url.

    I don't recommend you to use datatype as function in your case. By the way you can't use beforeRequest in case of usage datatype as function.

提交回复
热议问题