relaying keypresses to my main script
Hi, i really like what you've done so far. Congratz on one of the most amazing javascript-widgets i've ever seen.
I have been struggling on this problem for a day now, so i thought it might be better to ask it here, since i'm quite sure some other people will need the following functionality too. Here goes..
Is it possible to divert keypresses in the grid to another keyhandler without interrupting the workings of the grid itself? I need this because in my main app, the function keys will be shortcuts to various stuff.
I tried to do this already, but failed (none of the keys work anymore):
var newkeypress = function (event)
{
var keypressevent = obj.getEvent("onkeydown");
var dr = []; // I had to define this since i can't access kbActions for some reason
dr[33]="pageUp";
dr[34]="pageDown";
dr[35]="end";
dr[36]="home";
dr[38]="up";
dr[40]="down";
if(dr[event.keyCode]) {
keypressevent.call(this, event);
}
else {
alert(event.keyCode);
}
}
obj.setAction("mykeyhandler", function (event) {newkeypress(event)});
obj.setEvent("onkeydown", function(event) { obj.action("mykeyhandler"); });
Is there something i'm missing?
I have been struggling on this problem for a day now, so i thought it might be better to ask it here, since i'm quite sure some other people will need the following functionality too. Here goes..
Is it possible to divert keypresses in the grid to another keyhandler without interrupting the workings of the grid itself? I need this because in my main app, the function keys will be shortcuts to various stuff.
I tried to do this already, but failed (none of the keys work anymore):
var newkeypress = function (event)
{
var keypressevent = obj.getEvent("onkeydown");
var dr = []; // I had to define this since i can't access kbActions for some reason
dr[33]="pageUp";
dr[34]="pageDown";
dr[35]="end";
dr[36]="home";
dr[38]="up";
dr[40]="down";
if(dr[event.keyCode]) {
keypressevent.call(this, event);
}
else {
alert(event.keyCode);
}
}
obj.setAction("mykeyhandler", function (event) {newkeypress(event)});
obj.setEvent("onkeydown", function(event) { obj.action("mykeyhandler"); });
Is there something i'm missing?
Jo
June 11,