Programmatically closing dialog removes from DOM before hide event
raldred opened this issue · 3 comments
raldred commented
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 commented
I think this is fixed. At least, I just tried to reproduce, and could not. Let me know.
outocyt commented
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()
})
mode: 'blank',
headerText: 'Options',
headerClose: false,
dialogForce: true,
themeDialog: 'e',
callbackClose: function() { changeLkup(); },
blankContent : buildPopupContent()
})
alvinwoon commented
I have the same issue using latest jQuery Mobile