I have used search filters on one of my index view page. All the search filers are same for the second page too. I want to have a functionality in which the selected filter values from first page will be retained on the next filters too automatically and I don’t have to select the filters again on the next page.
3
Answers
On the index page you could add the search filters as query params to the url using jQuery.param(). On the next page you can parse and set the params as filters.
You could also store the values with localStorage.
The advantage of query params is that you can easily edit, bookmark and share the url. LocalStorage is better for storing large amounts of data. See also this SO answer.
You can use
localStorage
in index page to store the selected value of the filters and pass it as default value of filters in next pagesyou can use sessionStorage in first page . Because The value stored in sessionStorage will be deleted after the refresh.
after set sessionStorage you can use filter in next page :