jQuery UI Widgets › Forums › Dialogs and Notifications › Window › close event not fired when I try to close the modal window
Tagged: dialog, javascript dialog, jquery dialog, modal window
This topic contains 5 replies, has 3 voices, and was last updated by Peter Stoev 12 years, 3 months ago.
-
Author
-
Hi,
When I try to close the modal window using the button in the header, close /closed events are not getting fired.
What could be the issue?$("#objectModelWindow").bind('closed', function(event) { alert('Inside ObjectWindow Close Event'); $("#popupWindow").jqxWindow('setTitle', "Warning"); $('#popupWindow').jqxWindow({width:"480px" , height:"200px"} ); $("#popupWindow").jqxWindow('setContent','<div id="closeAlert" style="overflow: hidden;">'+ '<table><tr><td align="left">'+ 'There are certain modifications made to the Requirement(s) which are not' + '<br>submitted for update. Closing the window without submission would result'+ '<br>you in losing data.'+ '<br><br>Are you sure you want to continue?</td></tr>'+ '<td style="padding-top: 10px;" align="center">'+ '<input id="confirmClose" type="button" value="Yes" style="margin-right: 5px;"/>'+ '<input id="rejectClose" type="button" value="No"/>'+ '</td>'+ '</tr>'+ '</tr>'+ '</table></div>'); $('#popupWindow').jqxWindow('show'); });
Hi DollyB,
Make sure that you use the most recent version. We have an online demo with the latest version which demonstrates that the ‘close’ and ‘open’ events work: jquery-window-events.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi,
The following doesn’t work — taken from and tested in your example:
if (event.type === 'hide') { eventData += ', Dialog result: '; if (event.args.dialogResult.OK) { eventData += 'OK'; } else if (event.args.dialogResult.Cancel) { eventData += 'Cancel'; } else { eventData += 'None'; } }
Please provide a working sample with Ok and Cancel buttons that sets event.args.dialogResult properly. Or whatever other marker to indicate which button has been clicked.
Thx
Hi Lucian,
As a workaround subscribe to the Click event of the Cancel and OK buttons. That will enable you to distinguish which button is clicked. Another solution is to bind to the jqxWindow’s closed event.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comYes,
There are a couple of workarounds. 🙂But you must have something out of the box in this framework.
A simple confirmation yes/no modal popup is just a common use-case nowadays.Thx
Hi Lucian,
if (event.type === ‘hide’) does not work because the ‘hide’ event is obsolete and was replaced with another event in a recent version. That change was marked as a breaking. However, we missed to update the sample so that’s the reason I wrote you about the workarounds.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.