获取包含Jqgrid参数的当前url [英] Get current url including parameters of Jqgrid

查看:332
本文介绍了获取包含Jqgrid参数的当前url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望得到JqGrid包含页面,每页记录,搜索参数等对我的ajax服务的最后一个请求的完整URL。

I am looking to get the full url of the last request to my ajax service made by JqGridincluding page, records per page, search params etc.

有没有JqG​​rid api中的方法或方法集合我可以用来实现这个吗?

Is there any method or collection of methods within the JqGrid api I can use to achieve this?

推荐答案

jqGrid 不保存某处附加了所有参数的完整URL。因此,jqGrid API存档中的不可能 e。

jqGrid don't save somewhere the full URL appended with all parameters. So it is not possible within the jqGrid API archive this.

要查看完整的URL,您可以使用 Firebug Fiddler 或其他关闭工具。

To see full URL you can use Firebug, Fiddler or other close tool.

一般来说,众所周知如何构建网址。我如何间接理解你想使用HTTP GET( mtype:GET)。我在HTTP GET的情况下解释URL的构造。

In general it is well known how the url will constructed. How I understand indirectly you want use HTTP GET (mtype: "GET"). I explain the construction of the URL in case of HTTP GET.

GET请求的完整URL将构建于:

The full URL of the GET requests will constructed from:


  • url jqGrid的参数

  • postData jqGrid的参数

  • 一些额外的参数,取决于所使用的操作(第一次网格加载,数据搜索,配对等)。可以通过jqGrid的 prmNames 参数更改这些附加参数的名称(参见 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options#how_to_overwrite_global_options )。例如,如果您定义 prmNames:{sort:searchIndex,order:searchDirection,search:null,nd:null} 则参数 sidx sord 将重命名为 searchIndex searchDirection 。参数 _search nd 将不会发送。

  • url parameter of the jqGrid
  • postData parameter of the jqGrid
  • some additional paremeters which depend on the action used (first grid load, data searching, paring and so on). The names of this additional parameters can be changed by prmNames parameter of jqGrid (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options#how_to_overwrite_global_options). For example if you define prmNames: {sort: "searchIndex", order: "searchDirection", search: null, nd: null} then parameters sidx and sord will be renamed to searchIndex and searchDirection. Parameters _search and nd will not send.

下面你会找到一些典型的网址:

Below you find some typical urls:


  1. baseurl?_search = false& nd = 1250348761396& rows = 20& page = 1& sidx =& sord = asc

  2. baseurl?_search = false& nd = 1250348761396& rows = 20& page = 1& sidx = Name& sord = asc

  3. baseurl?_search = true& rows = 10& page = 1& sidx = Name& sord = asc& searchField = Manufacture& searchString = Micro& searchOper = bw

第一个网址请求加载第一页数据,每页20行,没有排序。第二个网址按名称排序。第三个网址包含数据过滤(使用简单搜索)过滤器 Manufacture Micro 开头并按名称。结果每页分页10行,并请求第一页。

The first url requests loading of the first page of data, 20 rows per page, no sorting. The second url has sorting by Name. The third url contain data filtering (with simple searching) based on the filter "Manufacture begins with Micro" and sorting by Name. Results are paged by 10 rows per page and the first page are requested.

如果使用高级搜索工具栏搜索而不是简单搜索网址看起来就像其他一些。 Everithing记录在 http://www.trirand.com/jqgridwiki/ doku.php ID =维基:jqgriddocs 。如果你还有其他问题我可以解释得更详细。

In case of using Advanced Searching or Toolbar Searching instead of Simple Searching the url will looks like a little other. Everithing are documented unter http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jqgriddocs. If you do have additional questions I'll can explain all more detailed.

重要的是要理解URL中使用的参数应该被编码。所以,如果你想 cunstruct你自己喜欢

It is important to understand that parameters used in URL should be encoded. So if you want cunstruct url yourself like

"baseUrl?firstName=" + myFirstName + '&lastName=' + myLastName

你不要忘记使用 encodeURIComponent 编码 myFirstName myLastName 的函数。而不是你可以使用 jQuery.param (参见为什么我的搜索代码无法在Internet Explorer上运行)或更好地使用 postData 参数jqGrid(参见 jqgrid不更新重新加载数据和< a href =https://stackoverflow.com/questions/2928371/how-to-filter-the-jqgrid-data-not-using-the-built-in-search-filter-box/2928819#2928819)e >如何使用内置的搜索/过滤器框过滤jqGrid数据。在最后一种情况下,如果需要,将在URL中插入符号'?'和'&',并且所有数据值将按照 encodeURIComponent 进行编码。

you should don't forget to use encodeURIComponent function to encode myFirstName and myLastName. Instead of that you can use jQuery.param (see why my search code does not work on internet explorer) or better use postData parameter of the jqGrid (see jqgrid not updating data on reload and How to filter the jqGrid data NOT using the built in search/filter box. In the last case symbols '?' and '&' will be inserted in the url if it is needed and all data values will be encoded with respect of encodeURIComponent.

这篇关于获取包含Jqgrid参数的当前url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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