获取网格的过滤器参数 [英] Get a Grid's Filter Parameters

查看:89
本文介绍了获取网格的过滤器参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQGrid,我想知道是否有一种方法可以获取已应用于我正在查看的网格的当前过滤器.例如,如果网格已按某个列(asc或desc)排序,则可能已应用搜索参数,等等.

I'm using jQGrid and I'm wondering if there is a way to get the current filters that have been applied to the grid I'm viewing. For example, if the grid has been sorted by a certain column (asc or desc), search parameters that may have been applied, etc.

这是我的问题:我想将一些参数传递回我正在查看的上一个网格(或最后一页),以便可以向前浏览时看到上一个网格.基本上,我有一个链接,用户将单击该链接,该链接将导航回到他们正在查看的上一个网格的页面.我想将过滤器参数与该链接一起传递.

Here is my problem: I would like to pass some parameters back to the previous grid I was viewing (or the last page) so that I can see the previous grid as it was when I navigated forward. Basically, I have a link the user will click which navigates back to the page with the previous grid they were viewing. I want to pass the filter parameters along with that link.

总体示例:

  1. 我按asc顺序按client_name字段过滤了客户端网格.
  2. 然后我单击了一个链接,该链接将我带到带有新网格的单独页面.
  3. 我想回到以前使用的客户端"网格,看到我的网格中的client_nameasc顺序过滤,就像我第一次离开时一样.
  1. I filtered the Client grid by the client_name field in asc order.
  2. I then clicked a link which takes me to a separate page with a new grid.
  3. I want to navigate back to the Client grid I was previously on, seeing my grid with client_name filtered in asc order as it was when I had navigated away the first time.

当前,我能够导航回客户端"网格,但我想获取已应用的过滤器参数,以便可以将其与我的链接一起传递.

Currently, I am able to navigate back to the Clients grid but I would like to get the filter parameters that had been applied so I can pass them with my link back.

让我知道我是否足够具体!

Let me know if I'm being specific enough!

感谢您的帮助!

推荐答案

我建议阅读答案和<一个href ="https://stackoverflow.com/a/8547852/315935">此.答案显示了如何通过使用window.localStorage解决非常紧密的问题.定义状态的jqGrid最重要的选项是:sortnamesortorder用于排序,searchpostData(主要是postData.filters)用于过滤,page用于分页.此外,如果您使用 columnChooser ,则需要使用jqGrid的remapColumns选项.您可以另外考虑有关当前所选行/行(selrowselarrrow)的信息.因此,您需要保存或还原的参数的确切列表取决于您的要求.

I would recommend to read the answer and this one. The answers shows how to solve very close problem by the usage of window.localStorage. The most important options of jqGrid which defines the state are: sortname, sortorder for sorting, search and postData (mostly postData.filters) for filtering, page for paging. Moreover if you use columnChooser you would need to use remapColumns option of jqGrid. You can include additionally take in consideration the information about current selected row/rows (selrow or selarrrow). So the exact list of the parameters which you need save or restore depends on your requirements.

这篇关于获取网格的过滤器参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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