Perspective table onKeyPress event not firing

I am trying to use keyboard events when clicked on the cell of a table.

I have a perspective table with an onKeyPress event script with just this line of code

system.util.getLogger("testlogger").error("test")

Pressing keys doesn't cause this to print to the log. I tried moving this code to the click event which did print to the log, so it's not an issue with the code. I also tried clicking on a cell to give it focus and pressing a key, but that also didn't do anything.

Any ideas why this isn't working?

Where are you looking for those logs at? The logger will print in the gateway logs not the designer's console.

To print to the designer console with perspective use this

system.perspective.print('Key Down: %s' % event.key)

I was looking at the gateway logs.

Did you do the same steps as me to get yours working?

Yes, I went to my table and added a keydown event. Then looked in the console or gateway logs, depending if you are logging or printing. It works for me.