ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Prevent popup closing on Esc key
Title:
B
I
{code}
?
Is there a way to prevent awe popup closing when pressing Esc key (seems to be different from jQuery UI dialog)? if I use closeOnEscape like in the docs: https://api.jqueryui.com/dialog/ awe.open(popUpID, {params:{id:0}}); I've got the error: Cannot call methods on dialog prior to initialization; attempted to call method 'option' I've created an add-on to minimize / maximize the popup because the popup is in front of a map. And inside of popup I have a button. When I press this button, I need this behavior: 1. Minimize popup, 2. Turn off the current popup Esc behaviour; 3. Create a Popup maximize behaviour on Esc key 4. Select a point on the map or press Esc key to cancel selection; 5. If a point is selected, or Esc key pressed, run a callback selection/cancel function; 6. Maximize popup and turn off maximize Esc behavior 7. Restore popup Esc behavior
Save Changes
Cancel
Kovacs Stefan
asked at 06 Nov 2019
Answers
B
I
{code}
?
The awesome library is not using `jQueryUI` for a long time already, so `.dialog` is not going to work. using latest version 6.3 based on this demo https://demo.aspnetawesome.com/PopupDemo#Confirm-popup-close you could it like this: $(document).on('awebfclose', function (e, opt) { var pdiv = $(e.target); // esc will be true when esc key was the cause of the close if (opt.esc) { opt.noclose = true; // this will prevent the popup from closing } }); and of course besides `opt.esc` you can add your additional condition like `&& pdiv.data('isMaximized')` --- old answer ( before v. 6.3 ) in `awem.js` you can find `function closeOnEsc(e) {` this is where esc close happens. in the `if (!popup.data('esc')) {` you can add an additional condition like if (!popup.data('esc') && !popup.data('noEscClose')) { and in your code you'll have to set this flag: $('#popUpID').data('noEscClose', true);
Save Changes
Cancel
Omu
answered at 06 Nov 2019
Thank You. This `awebfclose` solved my problem!
at 26 Nov 2019
Kovacs Stefan
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK