如何在单列搜索框中搜索2列? [英] How to search in 2 columns with single search box?
问题描述
dgrid.set(query,{name:new RegExp(searchKeyword,'i')} );
如何修改,以便我可以通过姓名和电子邮件进行搜索?
dojo / store / Memory
之后的查询引擎(称为 dojo / store / util / SimpleQueryEngine
)不支持 OR 操作,这意味着它不能查询所有记录:
名称匹配searchterm或电子邮件匹配searchterm
要解决这个问题,您将不得不使用不同的查询引擎比默认的。目前Dojo中没有其他查询引擎可用,但是有一个名为资源查询语言的独立项目。您应该检查此答案和图书馆本身在 Github 。
In my project, I would like to find by name and email in the dgrid. As of now, I am able to search by name only. I used the following:
dgrid.set("query", {name: new RegExp(searchKeyword, 'i')});
How do I modify this so that I can search by both, name AND email?
The querying engine behind a dojo/store/Memory
(called dojo/store/util/SimpleQueryEngine
) does not support OR operations, which means it can't query all records where:
name matches searchterm OR email matches searchterm
To solve that issue you will have to use a different query engine than the default one. Currently there are no other query engines available in Dojo but there is a standalone project called the resource query language. You should check this answer and the library itself on Github.
这篇关于如何在单列搜索框中搜索2列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!