我已经实现了给出这个问题的答案并且它有效,但是当用户单击搜索/查找按钮时生成的结果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=
更多推荐
发布评论