如何在 jqGrid 的请求中将 postData._search 设置为 true?
虽然我已经能够以编程方式添加自己的帖子数据,但我似乎无法弄清楚如何让此代码在请求中发送 _search: true
.
While I've been able to add my own post data programmatically, I cannot seem to figure out how to get this code to send _search: true
in the request.
var data = grid.jqGrid("getGridParam", "postData");
data._search = true;
data.searchString = id.toString();
data.searchOper = "eq";
data.searchField = "userid";
grid.jqGrid("setGridParam", { "postData": data });
grid.trigger("reloadGrid");
这些字段已正确添加,但在某处 _search 似乎设置为 false,因为每个请求都将其设置为 false.我还需要做些什么才能让它真实"吗?我正在运行工具栏搜索,但大多数时候调用此代码时没有输入任何内容,并且我的服务器上的大量实用程序代码会在处理搜索之前检查 _search.
The fields are added correctly, but somewhere along the way _search appears to be set to false, because every request has it set to false. Is there some other thing I have to do to have it "true"? I'm running a toolbar search, but most of the time when this code will be called there's nothing entered, and a decent chunk of utility code on my server checks _search before handling searches.
推荐答案
还有一个额外的参数,search
,需要设置它来启动搜索.postData
的 _search
参数不需要显式设置.我建议查找一些旧答案,您可以在其中找到如何使用搜索的示例:
There is an additional parameter, search
, which need be set to initiate the searching. The _search
parameter of postData
need not be set explicitly. I recommend to look up some old answers where you find examples how to work with searching:
- jqGrid 客户端搜索
- jqGrid:使用多种方法过滤数据
- jqGrid 清除搜索条件
相关文章