Reputation: 318
I have a page with a search form and I use vuetify's data-table for the search results, which can be sorted by columns.
If I click on an item in the table, I'm forwarded to that item's edit page. Then, if I click on the back button (this.$route.go(-1)) all the search terms, search results and sorting is gone and I have to do the same search again.
So the question is, how do I retain all the results and sorting selection in the data table?
I guess I can use localStorage with the search form input values?
Upvotes: 0
Views: 731
Reputation: 318
I ended up using vuex module for storing search form input and url for storing column sorting data. So when I go back, I can fill the form from the vuex store and set sorting from the route query.
Upvotes: 1
Reputation: 194
You could use the localStorage indeed with :value or use and implement the Vuex to centralise your data source.
This would make your data persistent to navigation but not to hard refresh as local storage would.
Upvotes: 1