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

Cannot open dialog with ajax #5717

Closed
ottoville opened this issue Feb 28, 2013 · 8 comments
Closed

Cannot open dialog with ajax #5717

ottoville opened this issue Feb 28, 2013 · 8 comments

Comments

@ottoville
Copy link

When opening a dialog with JavaScript in single-page template, the dialog fail to open.

How to repeat:
$.mobile.changePage("aPageThatisNotidDom.html", {transition: "pop", role: "dialog"})

Will cause error message: "Uncaught TypeError: Cannot read property 'nodeType' of undefined "

I traced the error and seems that reason for this migh be in line 8014, which is:
page = $el.closest( ":jqmData(role='page')" ),

It cannot find the content for variable "page", because on dialogs which are crawled with ajax, data-role attribute is a "dialog", not a "page".

Tested on Google Chrome 24, jQuery mobile 1.3.0, jQuery 1.9.1

@mrextreme
Copy link

I just found out there is no $( selector ).dialog( 'open' )... Wow.

In the meanwhile you can give a try using a popup as dialog. http://api.jquerymobile.com/popup/

@gabrielschulhof
Copy link

I cannot reproduce this using the latest version (http://jsbin.com/onibuc/340) or using 1.3.0 (http://jsbin.com/onibuc/342). If my jsbins do not reproduce the issue, please correct them and re-open this issue.

@mrextreme
Copy link

$.mobile.changePage() ...

In that case, the documentation ( http://api.jquerymobile.com/dialog/ ) needs an update, saying that this is the way of opening dialogs from JavaScript.

I cannot reopen the issue to keep it up until the documentation is updated. :(

@mrextreme
Copy link

Thanks.

@gabrielschulhof
Copy link

Blurb added. HTH!

@ottoville
Copy link
Author

I have tracked down the error and got jsfiddle example
http://jsfiddle.net/NTQ2L/

It is when dialog page contains a panel, when it trigger the error:
Uncaught TypeError: Cannot read property 'nodeType' of undefined

@gabrielschulhof
Copy link

This issue is fixed in branch ext-panels, which will be merged for 1.4.0.

@jaspermdegroot
Copy link
Contributor

The branch has been merged so I am closing as fixed. Let us know if this is still an issue in the 1.4 alpha release.

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

No branches or pull requests

4 participants