I tried doing selecting multiple rows using jquery but this code look like cranky.
http://jsfiddle.net/hKZqS/16/ .some more code added to above one.using shift + up arrow or down arrow using key board.
case 13:
var c = (e.keyCode ? e.keyCode : e.which);
var d =$(this).data('ID');
if(c == 13) { //Enter keycode
if(d != undefined){
window.open('k.php?q=' + d);
}
}
break;
}
$("#myTable tbody tr").shiftKeypress(function() {
$(this).toggleClass('selectmouse');
})
where am i going wrong?
Instead of given the TR a background.. try to give every TD underneave the TR.
UPDATE:
Okay, I’ve changed it! It’s working fine now.. What I changed:
$(document).keydown(… ->$(window).keydown(… // just somehow it works better when you doing with window(my experience).tr.ui-selecting { background: #eee; }->tr.ui-selecting td { background: #eee; }tr.ui-selected { background: #dde; }->tr.ui-selected td { background: #dde; }var selected = $("tr.ui-selected").first();->var selected = $("tr.ui-selected").first().find('td');.parent()from the$("tr.ui-selected").first().find('td');case 38:->case 65:for the ‘a’ button (alert(e.which) -> 65) // why not arrow up?case ??:->case 83:for the ‘s’ button (alert(e.which) -> 83) // why not arrow down?This should be it.
EDIT:
About the shift + arrow up or down you going to select as well!! So if I were you I would consider it if you want to use shift key
LAST UPDATE:
Here is the final code: http://jsfiddle.net/hKZqS/36/