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.
Overall Example:
- I filtered the Client grid by the
client_namefield inascorder. - I then clicked a link which takes me to a separate page with a new grid.
- I want to navigate back to the Client grid I was previously on, seeing my grid with
client_namefiltered inascorder 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!
Thanks for the help!
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,sortorderfor sorting,searchandpostData(mostlypostData.filters) for filtering,pagefor paging. Moreover if you use columnChooser you would need to useremapColumnsoption of jqGrid. You can include additionally take in consideration the information about current selected row/rows (selroworselarrrow). So the exact list of the parameters which you need save or restore depends on your requirements.