jqGrid postData属性未加载预加载的过滤器 [英] jqGrid postData property not loading pre-loaded filter
问题描述
我正在尝试使用已应用于网格的预定义过滤器加载页面.我尝试了以下代码,但未成功.
I am trying to have the page load with a pre-defined filter already applied to the grid.I've tried the following code without success.
$("table#worksheetsTable").jqGrid("setGridParam", {
gridComplete: function() {
//tried to set all this here too
},
postData: { searchField: "ScreeningNumber", searchString: "8882", searchOper: "bw" },
search: true
});
在第一个通话之外,我还尝试了$("table#worksheetsTable").jqGrid("setGridParam", {search: true})
.当我比较由此生成的表单值以及我用Fiddler自己单击过滤器时发生的表单值时,它们看起来都是一样的.
I've also tried $("table#worksheetsTable").jqGrid("setGridParam", {search: true})
outside of the first call as well. When I compare the form values generated with this and with what occurs when i click on the filter myself with Fiddler, they look the same.
UPDATE: Every example of this I've found has to do with multiple filters... I've finally found this answer from Oleg that explains (i think) that doing a single filter is different than doing multiple filters. I will update this and mark the answer once I try this.
推荐答案
在更改网格参数后添加trigger('reloadGrid'),如下所示:
add trigger('reloadGrid') after changing grid parameters like so:
$("table#worksheetsTable").jqGrid("setGridParam", {
gridComplete: function() {
//tried to set all this here too
},
postData: { searchField: "ScreeningNumber", searchString: "8882", searchOper: "bw" },
search: true
}).trigger('reloadGrid');
在随后的讨论之后进行
可能是您使用的参数名称的问题 根据您正在使用的帮助程序的文档
could be an issue of the parameter names you are using according to the documentation of the helper you are using
确保您在mvc操作方法中具有的请求参数名称与您在postdata中设置的名称相匹配,并且searchoperation枚举应包含"Bw"而不是"bw"-取决于帮助程序是否使用不区分大小写的方法解析枚举.
make sure the request parameter names you have in your mvc action method match whatever you set in your postdata, also the searchoperation enum is supposed to contain 'Bw' not 'bw' - depends on whether the helper uses a case insensitive method to parse the enum.
文档链接此处
这篇关于jqGrid postData属性未加载预加载的过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!