如何让 jqGrid 工具栏搜索工作? [英] How can I get jqGrid toolbar search working?

查看:27
本文介绍了如何让 jqGrid 工具栏搜索工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://trirand.com/blog/jqgrid/jqgrid.html, 在3.7 版的新功能">列搜索"下,有一种搜索方法的说明,我还没有用.我已添加:

At http://trirand.com/blog/jqgrid/jqgrid.html, under "New in Version 3.7" > "Column Search", there is a method explained to search, and it hasn't worked yet for me. I've added:

jQuery("#toolbar").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false});

以及示例中不太重要的代码.我的服务器看到略有不同的 JSON 请求,但没有 _search=true 和搜索词,永远没有.

and less essential code from the example. My server saw slightly different JSON requests, but no _search=true and no search term, ever.

http://trirand.com/blog/jqgrid/jqgrid.html 也给出了一个不完整的服务器端代码示例.示例 PHP 中给出了 SQL 语句:

http://trirand.com/blog/jqgrid/jqgrid.html also gives an incomplete example of server-side code. The SQL statement is given in the example PHP:

$SQL = "SELECT item_id, item, item_cd FROM items ".$where." ORDER BY $sidx $sord LIMIT $start , $limit";

但是,虽然 $sidx$sord$start$limit 都有代码定义它们,$where 未在页面上的其他任何地方定义(或引用).

but, while $sidx, $sord, $start, and $limit all have code to define them, $where is not defined (or referenced) anywhere else on the page.

如何获得像页面文档这样的列搜索,其中我的服务器被适当的请求命中?

How can I get a column search like the page documents, where my server is being hit by the appropriate requests?

推荐答案

filterToolbar 方法应该在您用来定义网格的同一元素上调用.查看工作示例使用它.

The filterToolbar method should be called on the same element which you use to define the grid. Look at the working example used it.

我无法帮助您解决问题的 PHP 部分,因为我自己不使用 PHP.尽管如此,来自演示文件blog/?page_id=6">jqGrid 下载页面 似乎包含一些可能对您有所帮助的 PHP 代码示例.

I can't help you with the PHP part of your question, because I don't use PHP myself. Nevertheless the demo files from the jqGrid download page seems to contain some PHP code examples which could be helpful for you.

这篇关于如何让 jqGrid 工具栏搜索工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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