I have a problem where the pagechange handler is firing twice within my app for some page transitions. In deviceready handler:
$(document).bind("pagechange", onPageChange);
Then the hander:
var onPageChange = function (event, data) {
var fromPageId = null;
//Get the ID of the page we are transitioning to.
var toPageId = data.toPage.attr("id");
//Get the ID of the page we are coming from.
if (data.options.fromPage) {
fromPageId = data.options.fromPage.attr("id");
}
console.log("pagechange to " + toPageId + " from " + fromPageId);
switch (toPageId){
...
}
}
When the app transitions from one page to the next, I can see in LogCat that the onPageChange is firing twice:
01-26 18:49:50.490: I/Web Console(18244): pagechange to care-plan-view from care-plan-view:25
01-26 18:49:50.490: I/Web Console(18244): pagechange to care-plan-view from care-plans:25
This is the order they appear in the log, weird thing is that the care-plan-view is the destination page and the care-plans is the start page!
This is a sample link that will cause the page transition issue:
<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="#care-plan-view?id=9e273f31-2672-47fd-9baa-6c35f093a800&name=Sat"><h3>Sat</h3></a>
Any ideas why this would be happening?
Cheers, Don