PDA

View Full Version : KeyNav help



majorpay
4 Oct 2007, 12:36 PM
I attached this to the body:


function setupKeyNav(){
var keynav = new Ext.KeyNav('docs', {
"up" : function(e){
ImageClass.prevImage();
},
"down" : function(e){
ImageClass.nextImage();
},
"left" : function(e){
ImageClass.prevPage();
},
"right" : function(e){
ImageClass.nextPage();
},
scope : this
});
}


where 'docs' is the body id - It works beautifully in IE 7, but doesn't work at all in Firefox. Any thoughts? I have also tried creating a body-wide div and using that - that doesn't work in FF either.

edit: in Firefox, there is only one place you can click on to get it to work (which opens a new page), but even after that, the keynav only works 1 time, then you have to click on the link again and go back to get it to work again.

majorpay
4 Oct 2007, 1:00 PM
Well thanks to me again for coming up with the solution!!! Binding the keys to document seemed to do the trick.

andrei.neculau
28 Mar 2008, 1:41 AM
http://extjs.com/forum/showthread.php?t=30528

You can also look in the source code of my extension - key navigated DataView.
Binding a KeyNav to document isn't that practical, especially if you have more spots with key navigation.