George
George

Reputation: 129

Framework7, how to make back button to work in page when content is loaed in the same page based on url variables

I have a page in framework 7 loading product categories using ajax. The content is loaded based on a url variable, eg product_categories.html?cat=1. By clicking on a product category the content is loaded onto the same page based on the cat variable. When i try to go back to a product category from a subcategory using the back button, the content that is being loaded is not that of the previous category, but that of the same category i am currently in. Am assuming that the url var is not being refreshed when clicking the back button. Is there a way to solve this? Thanks

Upvotes: 0

Views: 1089

Answers (1)

Stephen S
Stephen S

Reputation: 374

The way to fix this would be that instead of making the back button go back to the previous page, make it advance to the previous page. That means that instead of

mainView.router.back();

do

mainView.router.loadPage(/*url*/);

Note that this may mess up your logic elsewhere - if it does, you may need to look into refreshing with one of the following:

mainView.router.refreshPage()

mainView.router.refreshPreviousPage()

Upvotes: 1

Related Questions