Save and load filter state

How can I retrieve and save the current user inputted filter values in session ( or cookie) ?
User navigates away to some other page and then comes back to grid, I want to show him the grid with same filters applied.

To get current grid filter value you can use following code:

var filter_value=grid.getFilterElement(column_index).value;

To set filter back you can use following code:

grid.getFilterElement(column_index).value=filter_value; grid.filterByAll();