Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
bringPageTop and state of the app
-
Hi,
i have a player in the app. From the home page by pushpage when i go to the player page and play a song and come back to the home page and on revisiting the player page it reloads which loose the state of the player and selection goes away the song whihc was playing.
I have checked that if i use “bringPageTop” it can be achived. On using this function im getting an error “incorrect state of pageMap”.
onclick=“fn.bringPageTop ({‘id’: ‘./pages/mind-tracks.html’, ‘title’: ‘Mind Tracks’}, ‘slide’);”
window.fn.bringPageTop = function (page, anim) {
if (anim) {
document.getElementById(‘myNavigator’).bringPageTop(page.id, { animation: anim, data: { title: page.title } });
//document.getElementById(‘title’).innerHTML = page.title;} else {
document.getElementById(‘myNavigator’).bringPageTop(page.id, { data: { title: page.title } });
//document.getElementById(‘title’).innerHTML = page.title; this.querySelector(‘ons-toolbar div.center’).textContent = this.data.title;
}
};
-
Please let me know 1 thing that how a page which is already been opened should not run again if it is visited again.
I have a function which runs on init page and shows the tracks but as it is running again it loses the selection of the song which was playing.
Please help.
-
bringPageTop
is currently broken but there is a fix being worked on for it. See here for details: https://github.com/OnsenUI/OnsenUI/issues/2604
-
@emccorson
Thanks for your reply but can you please tell me how a page can be stopped to run again. the problem I’m facing is that it loses the state which the player was in.Any work around to this problem will be a big help.
-
i have seen that if i use tab the page doesnot reload but is there any other process how i can achieve this…
-
bringPageTop
will solve your problem once we have fixed the bug that I linked to. We are working on a fix forbringPageTop
that should be out at the end of this month.I think you have correctly identified a workaround though, by using
ons-tab
. You can setons-tabbar
to hidden like so:<ons-tabbar hide-tabs>...</ons-tabbar>
Then you can call
setActiveTab
to move to the player tab. In effect this is the same as usingons-navigator
andbringPageTop
.
-
@emccorson Many thanks I’ll try to hide as you have mentioned. But, please can you let me know if bringPageTop is fixed. I’m not in a hurry to finish the project.