获取包含Jqgrid参数的当前url [英] Get current url including parameters of Jqgrid
问题描述
我希望得到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.
有没有JqGrid 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 jqGridpostData
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 defineprmNames: {sort: "searchIndex", order: "searchDirection", search: null, nd: null}
then parameterssidx
andsord
will be renamed tosearchIndex
andsearchDirection
. Parameters_search
andnd
will not send.
下面你会找到一些典型的网址:
Below you find some typical urls:
- baseurl?_search = false& nd = 1250348761396& rows = 20& page = 1& sidx =& sord = asc
- baseurl?_search = false& nd = 1250348761396& rows = 20& page = 1& sidx = Name& sord = asc
- baseurl?_search = true& rows = 10& page = 1& sidx = Name& sord = asc& searchField = Manufacture& searchString = Micro& searchOper = bw
第一个网址请求加载第一页数据,每页20行,没有排序。第二个网址按名称
排序。第三个网址包含数据过滤(使用简单搜索)过滤器 Manufacture
以 Micro
开头并按名称$ c $排序C>。结果每页分页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屋!