Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Programmatically closing dialog removes from DOM before hide event #49

Open
raldred opened this issue Mar 22, 2012 · 3 comments
Open

Programmatically closing dialog removes from DOM before hide event #49

raldred opened this issue Mar 22, 2012 · 3 comments

Comments

@raldred
Copy link
Contributor

raldred commented Mar 22, 2012

I'm using a native dialog,

$('<div>').simpledialog2({
  'mode': 'blank',
  'headerText': 'Insert Image',
  'headerClose': false,
  'buttonPrompt': '',
  'dialogAllow': true,
  'dialogForce': true,
  'themeDialog': 'a',
  'blankContent' : t._buildFileUploadForm(),
});

Using $(document).trigger('simpledialog', {'method':'close'}); raises an error from jqm.

Uncaught TypeError: Cannot call method '_trigger' of undefined

the dialog is removed from the dom before jqm can trigger the 'hide' event.
The following line in jqm fails:

fromPage.data( "page" )._trigger( "hide", null, { nextPage: toPage } );

Closing directly with jqm's dialog function does not produce the error. eg.

$(document).find('[data-role="dialog"]:visible').dialog('close');

NB. Im using latest simpledialog2, jq 1.7.1, jqm @ 6f666d5

@jtsage
Copy link
Owner

jtsage commented Jun 11, 2012

I think this is fixed. At least, I just tried to reproduce, and could not. Let me know.

@outocyt
Copy link

outocyt commented Jun 19, 2012

I still get the error, even when closing using "Refresh". It happens for me when I open and close the dialog a few times. Once I get the error, it won't open anymore.

$('

').simpledialog2({
mode: 'blank',
headerText: 'Options',
headerClose: false,
dialogForce: true,
themeDialog: 'e',
callbackClose: function() { changeLkup(); },
blankContent : buildPopupContent()
})

@alvinwoon
Copy link

I have the same issue using latest jQuery Mobile

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