默认情况下使用多个字段进行多次搜索 [英] Multiple search with multiplefields by default

查看:33
本文介绍了默认情况下使用多个字段进行多次搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,有一个带有声明的 jqGrid,比如:

$("#grid").jqGrid({...一堆东​​西...).searchGrid({ multipleSearch: true });

这很好,当我单击搜索"按钮时,它给我带来了模态表单,我猜是第一列和一个下拉列表:searchoptions: { sopt: ['eq', 'ne', 'cn']}.现在,我希望能够默认显示几个这样的字段,而不仅仅是一个.我知道我可以稍后通过单击添加来添加这些,但我想默认显示它们.

工具栏搜索不是一种选择.

提前致谢,

解决方案

查看 您将找到如何删除搜索对话框的最后一行(带有Inv No"),它们不是 postData.filters 中搜索规则的一部分.

So, there is a jqGrid, with declaration, smth like:

$("#grid").jqGrid({
...
bunch of stuff
...
).searchGrid({ multipleSearch: true });

which is fine, when I click Search button, it brings me modal form with I guess first column and a dropdown of sopts: searchoptions: { sopt: ['eq', 'ne', 'cn']}. Now, i want to be able to display a couple of such fields by default not just one. I know I can add those later, by clicking Add, but I want to display them by default.

Having toolbar search is not an option.

Thanks in advance,

解决方案

Look at the Toolbar Searching. It shows one field per searchable column. If you use additionally stringResult:true option, you will receive the most compatible results to the Advanced Searching. By the way it you include both features Toolbar Searching and Advanced Searching (multipleSearch: true) the advanced searching dialog will be initialized with the last searching results from the Toolbar Searching. So you will have two or three rows in the Advanced Searching at the beginning.

UPDATED: The reason why after the usage of the Toolbar Searching the dialog with the Advanced Searching will be displayed not empty is that both use filters parameters of the postData. So if you initialize the postData you can receive a good starting point. See on the demo. You will see

UPDATE: In another answer you will find how to delete the last line of the searching dialog (with "Inv No") which are not the part of the searching rules from the postData.filters.

这篇关于默认情况下使用多个字段进行多次搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆