how to close p:dialog on ESC key
AFAIK, this issue there is in the issue tracker and will be fixed in the future.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
works create, now.
Did it like this:
Did it like this:
Code: Select all
jQuery(document).keyup(function(keyPressEvent) {
// evaluate key code
var key = keyPressEvent.keyCode ? keyPressEvent.keyCode : keyPressEvent.which ? keyPressEvent.which : keyPressEvent.charCode;
if (key == 27) { //escape
closeOnEscape();
}
});
function closeOnEscape() {
var closeable;
var indexHighest = 0;
jQuery(".ui-dialog.ui-widget.ui-widget-content.ui-overlay-visible").each(function() {
var indexCurrent = parseInt($(this).css("zIndex"), 10);
if (indexCurrent > indexHighest) {
indexHighest = indexCurrent;
closeable = this;
}
});
if (closeable != null) {
jQuery(closeable).removeClass('ui-overlay-visible').addClass('ui-overlay-hidden');
jQuery(closeable).css({'visibility':'', 'z-index':'', 'display':''});
var modal = '#' + jQuery(closeable).attr('id') + '_modal';
jQuery(modal).remove();
}
}
PF 6.x, Weblogic 12c, JDK8, NetBeans 8.x
-
- Posts: 62
- Joined: 03 Aug 2012, 21:01
Any update on this? I just tried it and in the latest version it seems to still be an issue, thanks
use the the jquery sample above.
Issue is under http://code.google.com/p/primefaces/iss ... il?id=4209, but still not implemented
Issue is under http://code.google.com/p/primefaces/iss ... il?id=4209, but still not implemented
PF 6.x, Weblogic 12c, JDK8, NetBeans 8.x
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
closeOnEscape will be available in 3.5. Implemented in trunk as of today.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 24 guests