在jqGrid中设置默认搜索列后,如何将searchField包含为url参数?(After setting default search column in jqGrid, how to inclu

编程入门 行业动态 更新时间:2024-10-24 14:24:26
在jqGrid中设置默认搜索列后,如何将searchField包含为url参数?(After setting default search column in jqGrid, how to include searchField as url parameter?)

我已经实现了给出这个问题的答案并且它有效,但是当用户单击搜索/查找按钮时生成的结果URL不包含searchField参数,因此我的服务器代码不返回数据。 如果我删除列:[]搜索选项部分,我的搜索列不再排序,但searchField返回到URL。 我还能做些什么来将此参数返回给查询字符串吗?

下面是我的寻呼机代码。

$("#AllContactsTable").jqGrid('navGrid', "#AllContactsPager", { search: true, refresh: false, reload: false, add: false, del: false, edit: false }, {}, {}, {} , { overlay: 0, width: 650, top: 0, left: 100 //,columns: [ // getColumnByName.call($grid, 'LastName'), // getColumnByName.call($grid, 'FirstName'), // getColumnByName.call($grid, 'MiddleName'), // getColumnByName.call($grid, 'HomePhoneNumber'), // getColumnByName.call($grid, 'CellPhoneNumber'), // getColumnByName.call($grid, 'WorkPhoneNumber'), // getColumnByName.call($grid, 'ContactID') //] });

I've implemented the answer given to this question and it works but the resulting URL that is generated when the user clicks the search/find button does not include the searchField parameter and thus my server code does not return data. If I remove the columns:[ ] section of search options, my search columns are no longer sorted, but the searchField returns to the URL. Is there something else I can do to return this parameter to the query string?

Below is my pager code.

$("#AllContactsTable").jqGrid('navGrid', "#AllContactsPager", { search: true, refresh: false, reload: false, add: false, del: false, edit: false }, {}, {}, {} , { overlay: 0, width: 650, top: 0, left: 100 //,columns: [ // getColumnByName.call($grid, 'LastName'), // getColumnByName.call($grid, 'FirstName'), // getColumnByName.call($grid, 'MiddleName'), // getColumnByName.call($grid, 'HomePhoneNumber'), // getColumnByName.call($grid, 'CellPhoneNumber'), // getColumnByName.call($grid, 'WorkPhoneNumber'), // getColumnByName.call($grid, 'ContactID') //] });

最满意答案

我试图重现你描述的问题,但不能。 一切正常。 在更新的部分答案中,我引用了另一个答案 ,其中我描述了4.4.5版本中的错误(以及更旧的版本)。 我建议修复的内容(见这里 )。 版本4.5和jqGrid的当前版本4.5.2包括修复程序。

该演示证明一切正常。 另一个演示集datatype: "json"和url: "someDummyUrl" 。 您可以使用Fiddler , Firebug ,IE或Chrome的开发人员工具来跟踪HTTP流量。 您将看到URL将正确附加searchField , searchString和searchOper :

searchField=amount&searchString=200&searchOper=eq&filters=

I tried to reproduce the problem which you described, but can't. All works correctly. In UPDATED part of the answer I referenced another answer where I describe the bug in version 4.4.5 (and more old versions too). The fix which I suggested are fixed in the (see here). The version 4.5 and the current version 4.5.2 of jqGrid included the fix.

The demo demonstrate that all works correctly. Another demo set datatype: "json" and url: "someDummyUrl". You can use Fiddler, Firebug, Developer Tools of IE or Chrome to trace HTTP traffic. You will see the URL will be correctly appended with searchField, searchString and searchOper:

searchField=amount&searchString=200&searchOper=eq&filters=

                    
                     
          

更多推荐

本文发布于:2023-08-05 16:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1433973.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   参数   searchField   url   jqGrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!