设置查询以搜索 dojo 数据网格的所有字段

发布于 2024-11-29 08:10:02 字数 262 浏览 0 评论 0原文

我有一个包含多个字段的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮生面具三千个 2024-12-06 08:10:02

您的商店是 ItemFileReadStore 还是 QueryReadStore

如果 ItemFileReadStore 您可以使用 AndOrReadStore
http://dojotoolkit.org/reference-guide/dojox/data/AndOrReadStore.html

否则,我对有限获取存储的最佳建议是调整后端代码以支持过滤选项,这样当存储进行 POST(或 GET)时,您可以解析出所需的字段数组搜索反对,并相应返回结果集。

您会看到类似的内容,

start 0
count 25
columnsToQuery : ["name","friend","family"]  //or perhaps a CSV string will do
columnOperator : "AND"
columnValue : "Bob"

您必须根据您的业务需求调整范例,但只要服务器可以根据过滤输入正确返回结果集,这种方法就可以工作。

生成此类请求的调用将是

grid.setQuery({
  columnsToQuery : ["name","friend","family"],
  columnOperator : "AND",
  columnValue : "Bob"
});

Is your store an ItemFileReadStore or a QueryReadStore?

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

start 0
count 25
columnsToQuery : ["name","friend","family"]  //or perhaps a CSV string will do
columnOperator : "AND"
columnValue : "Bob"

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

grid.setQuery({
  columnsToQuery : ["name","friend","family"],
  columnOperator : "AND",
  columnValue : "Bob"
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文