Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

TypeError: toPage.data("page") is undefined #2640

Closed
rmilesson opened this issue Oct 7, 2011 · 7 comments
Closed

TypeError: toPage.data("page") is undefined #2640

rmilesson opened this issue Oct 7, 2011 · 7 comments

Comments

@rmilesson
Copy link

I've put together a simple testcase for you to see the issue for yourselves. http://data.fuskbugg.se/skalman02/36fa2d81_toPage_undefined.rar

Start at index.html and try getting to step 2 of the sign in process by just using the links at hand.

Using http://code.jquery.com/jquery-1.6.4.js and http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.js

Issue:

Browse to signin.html from index.html, everything looks fine, when you try getting to page #step-2 of signin.html you'll be thrown back to index.html (at least the view, the url is still signin.html#step-2, like it should be.)
When using the Firebug console and running $.mobile.changePage($('#step-2')) I'll get "TypeError: toPage.data("page") is undefined" thrown in my face.

I find no information about this issue anywhere, and I have no idea why this happens.

Edit: It seems this is "working as intended" as this seems to be a really old issue.

#2637
#1995

Horrible.

@johnbender
Copy link
Contributor

@rmilesson

Can you create an example using jsbin or jsfiddle? That will make our lives easier, and help us address the issue faster!

@rmilesson
Copy link
Author

As soon as I get home! Our project is very close to launch and a bug of this
caliber shouldn't exist in a rc.
Den 7 okt 2011 18:36 skrev "John Bender" <
[email protected]>:

@rmilesson

Can you create an example using jsbin or jsfiddle? That will make our lives easier, and help us address
the issue faster!

Reply to this email directly or view it on GitHub:
#2640 (comment)

@johnbender
Copy link
Contributor

@rmilesson

I can't seem to get your rar unpacked, but one thing you should keep in mind is that pages loaded via ajax will only load the first data-role=page element. See #2637, which is the only reason I mention it, being unable to view your source.

@vail130
Copy link

vail130 commented Jan 17, 2012

I had the same problem. It is not related to loading two different page data roles through AJAX.

Here is a jsfiddle: http://jsfiddle.net/jGKWU/

Click on "Work" and then click on any of the "Client #" links. This action causes the error.

Good luck!

EDIT:

Okay, it turns out that the problem was this:

$page = $(pageSelector)

because pageSelector was the id of the page, so I changed it to this:

$page = $(document.getElementById(pageSelector))

and all is good.

@raDiesle
Copy link

Still, with Jqm 1.1.0 the bug is there. To summarize (using backbone ):

this.cleanupPossiblePageDuplicationInDOM();

$(this.el).html(htmlContent);
$(this.el).attr("data-role", "page");

$("body").append($(this.el));

// --> SOLUTION FOR ME
$("#" + this.id).page();
// without error is thrown: -> toPage.data("page") is undefined
// trigger('create') doesn't work for me

$.mobile.changePage("#" + this.id, {
transition : 'slideup',
reverse : false,
changeHash : false,
role : page
});

...

$(document).bind("mobileinit", function(){
$.mobile.ajaxEnabled = false;
$.mobile.hashListeningEnabled = false;
$.mobile.pushStateEnabled = false;
});

@arschmitz
Copy link
Contributor

@toddparker @johnbender @uGoMobi in the fiddle they are trying to pass query params to internal pages (not supported) per http://jquerymobile.com/test/docs/pages/page-navmodel.html so i would close this its also been stale for a year from OP and 5 months from anyone else

@jaspermdegroot
Copy link
Contributor

@rmilesson

Closing the issue based on the note you added saying it is working as intended. Please comment if you still see something we can improve here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants