New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Back Navigation issue with Query Params #1903
Comments
try using it like this < a href="/detail-article/?id=0">l-back</ a > |
@rapgithub u mean like this
yeah, right now I use it instead |
what version of F7 you use? read this because i think you are not using the methods in f7 specified for page linking... in Page Data Properties and read about View Navigation Methods you use this mainView.router.loadPage(url) to go to specific page or this to go back in history I use this way and works fine!! |
for linking back in history you can also use just this class="back link" < a href="#" class="back link"> Back</ a> or check mainView.router navigation methods for more methods, this link above: https://framework7.io/docs/router-api.html I hope you get it resolved! :) |
check dynamicNavbar is true in your my-app.js // Add view i this helps too |
and for your query when going back try to check this on that page on page init $$(document).on('page:init', function (e) { it should print your query string to the console to see if the query is there |
i was using this
it was no luck...so i use this instead
but i'll check your sugesstions above |
check dynamicNavbar: true in my case it works fine class back link but if you need to go deeper just use better the mainView.router navigation methods |
yes...I set dynamicNavbar: true already, |
remember this if you use the router... use myApp.onPageAfterAnimation myApp.onPageAfterAnimation(pageName, callback(page)) - "callback" function will be executed after page (with "pageName" data-page attribute) animation myApp.onPageAfterAnimation('pageName', function (page){ }); |
force: true, is important!! |
myApp.onPageAfterAnimation('pageName', function (page){ console.log(page.query); //show your query string if you use router back you use it like this : mainView.router.back({url: 'yourpage.html', force: true, ignoreCache: true,reload: true}); |
great....I'll try it.... |
what do u suggest , calling Ajax inside onPageinit or onPageAfterAnimation ?
|
none of the above works...here i put my complete code @rapgithub
and this detail.html
I navigate to : mobil.html -> motor.html -> detail.html?id=45 When I hit Back (not browser Back button) on detail, it goes to mobil instead of motor |
i will check this... what is your issue... |
the issue is still the same
What i expect when press Back is that it goes back to Previous visited page , the motor page |
I will check this weekend your code but if you have some extra samples send them to me to check them out and see if i can help you |
checking it later or tomorrow OK take it easy 👍 |
are you using 1.6.5? |
yaap...im using ver 1.6.5 |
i have tested your code and i can see that the main issue of going back is that maybe you are using the onPageInit callback to know which page you are going back the problem with onPageInit is that if you print the page.name when going back the page.name will always be index not the previous one, dont ask me why but it is so... so you need to use for correct page the onPageAfterAnimation and onPageBeforeAnimation that will always gives you the correct page name regarding how deep you are in the router paths.. i have included here my test code with 3 pages you metioned and it works fine with query parameters as well and with on click events or inline href page references... I have included the console.log to print the console on every page and show you it works and in the last detail page i have created three links two with inline href links and the other with on click event... remember when you use on click in pages deeper than index it is better to use this form below to ensure the links are clickable and works... $$(document).on('click', '.class-name', function (e) I hope this can solve your issue ! :) I have commented the lines below in the my-app.js because you do not need this ones but in case you want to test the myApp.onPageInit behavior you can uncomment them to see what i meant with page.name not showing the correct when going back... better use always onPageAfterAnimation and onPageBeforeAnimation for correct page names... //myApp.onPageInit('index', function (page) { ... one important thing the initialization in my case i have added this var myApp = new Framework7({ and at the end i initialize it like this myApp.init(); |
let me know if you can make it work now :) 👍 |
remember do not use page:init to run things when you want to go back because page.name will always be index use the other methods onPageAfterAnimation and onPageBeforeAnimation in your my-app.js and viola! :) |
i added page.query to the onPageAfterAnimation methods and the console.log show the query perfectly see this below: onPageAfterAnimation: function (app, page) {
|
Hi...im soory, have checked it yet.. I'll check it on Monday.... Thanks for the help |
Welcome! |
Issue is closed because of outdated, irrelevant or not actual If this issue is still actual and reproducible for latest version of Framework7, please create new issue and fill the issue template correctly:
|
I have issue with Back navigation if I query params like this
before, I navigate to : Catagory1.html -> Category 2.html -> DetailArticle.html?id=45
When I hit Back (not browser Back button) on Detail, it goes to Catagory1 instead of Category 2
The text was updated successfully, but these errors were encountered: