Hi Folks,
Since I did not find an editable grid that suits my requirement (of
being light weight and editable) I started writing
my own - here’s what I’m trying -
A helper function like this that renders a grid -
def mygrid(row,col)
table=’
Col #{c} | ”
---|
<input id=“col_#{r}_#{c}” style=“border:none;” type=“text” onkeydown=“handle_keyboard(event,#{r},#{c},#{row})”> | ”
end
And the supporting js function -
function handle_keyboard(e,r,c,max_r){
var code=e.keyCode;
if(code==13 || code==40){
r=r+1;
if(r>max_r)r=1;
id=‘col_’+r+""+c;
document.all[id].focus()
}
if(code==38){//up
r=r-1;
if(r<1)r=1;
id='col’+r+"_"+c;
document.all[id].focus()
}
}
I intend to add Ajax to it - but before that I wanted to understand if
I’m doing all this and there’s a better solution already out there.
–
Regards,
Kashyap