jquery-mobile-simpledialog icon indicating copy to clipboard operation
jquery-mobile-simpledialog copied to clipboard

Programmatically closing dialog removes from DOM before hide event

Open raldred opened this issue 12 years ago • 3 comments

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

raldred avatar Mar 22 '12 15:03 raldred

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

jtsage avatar Jun 11 '12 21:06 jtsage

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()
})

outocyt avatar Jun 19 '12 18:06 outocyt

I have the same issue using latest jQuery Mobile

alvinwoon avatar Sep 18 '12 07:09 alvinwoon