同步jqGrid过滤器工具栏和searchGrid过滤器 [英] Sync jqGrid filterToolbar and searchGrid filters
问题描述
我正在同时使用带有filterToolbar和searchGrid的jqGrid.
I am using a jqGrid with both filterToolbar and searchGrid.
当我使用filterToolbar进行搜索,然后打开searchGrid窗口时,过滤器将填充得很好.
When I perform a search using the filterToolbar and then open the searchGrid window, the filters come filled fine.
但是当我在此之后更改某些内容时,此功能将停止工作.
But when I change something after this, this feature stop working.
我可以通过测试此示例来解释: http://srv04.wln.com.br/cpsadmin/sample
I can explain by testing this sample: http://srv04.wln.com.br/cpsadmin/sample
尝试在filterToolbar中的名称",地址"和城市"字段中键入"a",然后执行搜索(将焦点放在任何输入时按回车键).
Try typing an 'a' for the fields Name, Address and City in the filterToolbar, then perform a search (pressing return when focus in any input).
然后,单击页脚栏上的查找记录"按钮,这将打开搜索窗口,并根据filterToolbar搜索选项填充3个字段.
After that, click in the 'Find Records' button at the footerBar, this will open the search window, with the 3 fields filleds according with the filterToolbar searchoptions.
但是,如果我们在此之后尝试执行某些操作,则由于刷新页面,因此再也无法正常工作了.
But if we try to do something after this, nothing works ok again, since we refresh the page.
我想同时使用两种方法来获得filterToolbar和searchGrid的强大功能.
I would like to get the power of both, filterToolbar and searchGrid, working together, and in the two ways.
推荐答案
您可以尝试添加recreateFilter: true
搜索选项.为了能够找到问题的确切原因,您应该在演示页上使用jquery.jqGrid.src.js
而不是jquery.jqGrid.min.js
.
You can try to add recreateFilter: true
searching option. To be able to find the exact reason of the problem you should use jquery.jqGrid.src.js
instead of jquery.jqGrid.min.js
on your demo page.
我还建议您使用答案中建议的refreshSerchingToolbar
函数.还有一个 answer 和
I recommend you additionally to use refreshSerchingToolbar
function which I suggested in the answer. One more answer with the demo could be also interesting for you. It show how to save last searching filter (and some other information) in the localStorage
. At the visit of the same page the previous used searching filter will be applied.
已更新:这与口味有关,但我个人使用设置
UPDATED: It's a little the matter of the tasted, but I personally use the settings
$.extend($.jgrid.search, {
multipleSearch: true,
multipleGroup: true,
recreateFilter: true,
closeOnEscape: true,
closeAfterSearch: true,
overlay: 0
});
或一些更高级的版本作为我的默认高级搜索"设置. recreateFilter: true
类似于 recreateForm:true 表单编辑总是 我的默认设置.我建议了很多次(请参阅
or some more advanced version as my default Advanced Searching settings. The recreateFilter: true
like recreateForm: true for the form editing are always my default settings. I suggested many times (see here for example) to make the settings as jqGrid defaults, but the suggestings stayed unanswered. Tony (the developer of jqGrid) has another opinion on the subject.
这篇关于同步jqGrid过滤器工具栏和searchGrid过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!