如何在jqGrid中的请求中将postData._search设置为true? [英] How can I set postData._search to true in the request in jqGrid?
问题描述
虽然我已经能够以编程方式添加自己的帖子数据,但我似乎无法弄清楚如何让这段代码在请求中发送 _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:使用多种方法过滤数据
- < a href =https://stackoverflow.com/questions/3989786/jqgrid-clear-search-criteria/3992417#3992417> jqGrid清除搜索条件
- jqGrid client-side searching
- jqGrid: using multiple methods to filter data
- jqGrid clear search criteria
这篇关于如何在jqGrid中的请求中将postData._search设置为true?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!