On my main page, when it goes live
$('#mainPage').live('pagecreate', function (event) {
if (window.openDatabase) {
//createDatabase();
//etc
I list a table out to the screen... I have a Maintenance button/page that allows me to edit, delete some entries.
I want to be able to re-list that table on the main page when I click BACK from my maintenance page (since that table has most likely开发者_StackOverflow中文版 changed) but I cannot figure out what event is called when a page is transitioned too...
Nothing happens in the .live('pagecreate' -- event... I tried pageinit... I am missing something here.
Help?
Here's what I found:
- I was using the data-rel="back" on my button which kept taking me to index.html rather than the div name (#mainPage)... so I removed the back behavior because I really didnt need it. (not sure what I would do if I did)
read more of the jq mobile docs (imagine that) and found this rather verbose way:
$(document).bind("pagebeforechange", function (e, data) {
// We only want to handle changePage() calls where the caller is // asking us to load a page by URL. if (typeof data.toPage === "string") { // We are being asked to load a page by URL, but we only // want to handle URLs that request the data for a specific // category. var u = $.mobile.path.parseUrl(data.toPage); var re = /^#mainPage/; if (u.hash.search(re) !== -1) { listZooAnimals(); } } });
This just feels like serious overkill and that I might still be missing some easier way of doing this.
精彩评论