Closing dialog with esc key

Components, Ajax Framework, Utilities and More.
Post Reply
melancos
Posts: 3
Joined: 12 Jan 2012, 14:12

12 Jan 2012, 14:28

I have just upgraded to version 3.0 from 2.2 and now the 'esc key' doesn't close a dialog component. I expected the same behaviour no matter the version.

Currently I am using JSF 2.0 with Mojarra 2.0.3 and Tomcat 6.0.28 as servlet container.

Is this a bug or am I doing something wrong?

Thanks very much in advance

User avatar
optimus.prime
Prime
Posts: 17420
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

12 Jan 2012, 14:29

It's gone in 3.

melancos
Posts: 3
Joined: 12 Jan 2012, 14:12

12 Jan 2012, 14:47

I appreciate your quick response, optimus.

I have read dialog is reimplemented as a native PrimeFaces component in this new version. Is it planned for future versions, or is it definetively gone?

User avatar
optimus.prime
Prime
Posts: 17420
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

12 Jan 2012, 14:49

It can be back but it is not in our immediate roadmap.

melancos
Posts: 3
Joined: 12 Jan 2012, 14:12

12 Jan 2012, 14:55

OK, I see :(

Anyway, thank you very much

csotolani
Posts: 4
Joined: 17 Jul 2012, 00:09

17 Jul 2012, 00:12

Code: Select all

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

<p:hotkey bind="esc" handler="closeOnEscape();" />

csotolani
Posts: 4
Joined: 17 Jul 2012, 00:09

25 Jul 2012, 17:47

Code: Select all

<script type="text/javascript">
jQuery(document).keyup(function(e) {
if (e.keyCode == 27) { //esc
closeOnEscape();
}
});
</script>

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests