hotkey fires on each key

UI Components for JSF
Post Reply
Tarlnar
Posts: 3
Joined: 14 Jan 2011, 15:00

14 Jan 2011, 15:23

Hi, i am facing a Hotkey Problem with the actual 2.2 RC2 build.

I am using following hotkey,

<p:hotkey bind="f3" handler="clickLink('form','3');" />

and the clicklink method is executed every time any key is pressed.
It seems to me the bind value is not evaluated correctly!?
Am i doing somethin wrong?

With the 2.0.2 build everything works fine..

A simple example..
<p:hotkey bind="a" handler="alert('a pressed');" />
The alert appears for every pressed key.

robert.m
Posts: 226
Joined: 07 Dec 2010, 22:52
Location: Salzburg/Austria

14 Jan 2011, 17:37

have you tried using the key-combination of the showcase-example? (which is "ctrl+shift+s")
maybe it's not even possible to bind to a single character key or the f-keys

you might wanna check out the jQuery documentaion for the bind-function, as jQuery is used to realize the behaviour of the <p:hotkey>-component

Tarlnar
Posts: 3
Joined: 14 Jan 2011, 15:00

17 Jan 2011, 10:42

I tried the key-combination of the showcase-example.. and i get the same error!
At the moment i press "ctrl" (or any other key!!!) the handler is called/ the alert apears immediately.

For me the handler is called, doesn't matter which key is bind!

I'm going to have a look for the jQuery documentation.

Tarlnar
Posts: 3
Joined: 14 Jan 2011, 15:00

17 Jan 2011, 19:09

I think i found the problem.
The "HotkeyRenderer" class has a new implementation with this version.
With an earlier version of this class everything works fine.

With 2.2 the "jQuery(document).bind(....)" is encapsulated with "jQuery(function() {

example: -->
with 2.0.2 or 2.1: jQuery(document).bind('keydown', 'a', function(){alert('a pressed');;});

with 2.2: jQuery(function() {jQuery(document).bind('keydown', 'a', function(){alert('a pressed');;return false;});});

Maybe someone can explain the changes?
Maybe there is a failure?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Malcolmtoige and 24 guests