设置查询以搜索 dojo 数据网格的所有字段
我有一个包含多个字段的 Dojo DataGrid。我目前正在将查询设置为一次搜索一个字段,如下所示:
grid.setQuery( {name:"Bob"}, {ignoreCase:true} );
但是我希望查询一次搜索所有字段。例如,假设我有三个标题为“姓名”、“朋友”、“家人”的字段。假设我只想在网格中显示三个字段中任何一个字段中包含“Bob”的行。如果没有三个单独的查询,我将如何做到这一点?
任何帮助表示赞赏。
I have a Dojo DataGrid with several fields. I'm currently setting the query to search one field at a time, like so:
grid.setQuery( {name:"Bob"}, {ignoreCase:true} );
However I would like the query to search all the fields at once. For example say I have three fields titled "name", "friend", "family". Let's say I only want the rows that contain "Bob" in any of the three fields to show in the grid. How would I got about doing that without three separate queries?
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的商店是
ItemFileReadStore
还是QueryReadStore
?如果 ItemFileReadStore 您可以使用 AndOrReadStore
http://dojotoolkit.org/reference-guide/dojox/data/AndOrReadStore.html
否则,我对有限获取存储的最佳建议是调整后端代码以支持过滤选项,这样当存储进行 POST(或 GET)时,您可以解析出所需的字段数组搜索反对,并相应返回结果集。
您会看到类似的内容,
您必须根据您的业务需求调整范例,但只要服务器可以根据过滤输入正确返回结果集,这种方法就可以工作。
生成此类请求的调用将是
Is your store an
ItemFileReadStore
or aQueryReadStore
?If ItemFileReadStore you may be able to utilize the AndOrReadStore
http://dojotoolkit.org/reference-guide/dojox/data/AndOrReadStore.html
Otherwise, my best suggestion for a limited fetch store would be to adjust your back-end code to support filtering options such that when the store makes a POST(or GET), you parse out an array of fields that you want to search against, and the result set is returned accordingly.
You'd see something like
You'd have to adjust the paradigm as per your business needs, but as long as the server can properly return the result set based on the filtering inputs this approach will work.
The call to generate such a request would be