如何使用jqgrid和http方法POST将额外的参数传递给服务器?

lar*_*ole 4 asp.net-mvc jqgrid

我正在做类似这篇文章中的人:有没有办法在jquery jqgrid中以编程方式设置过滤器?

我正在使用http方法POST从我的MVC2项目中获取数据,我看到你可以使用GET这样添加一个参数:

You can modify the url that jqGrid calls, and add the filter option to the querystring, then handle it on the server side.

    $(link).click(function(){

    $(".mygrid").jqGrid('setGridParam',{url:"server.php?useMyFilter=1"})
    });
Run Code Online (Sandbox Code Playgroud)

如何使用POST添加额外的过滤器参数?

Cra*_*ntz 5

对于这两个GET POST你可以设置postData:

$(".mygrid").jqGrid('setGridParam',
{
     url:"server.php",
     postData: {
         useMyFilter: 1
     }
});
Run Code Online (Sandbox Code Playgroud)

请注意,您的来电jqGrid()缺少了;