如何使用键盘箭头键操作jquery数据表行

如何使用键盘箭头键操作jquery数据表行,jquery,keyboard,datatable,navigation,Jquery,Keyboard,Datatable,Navigation,如何使用键盘箭头键操作datatable(jquery插件)行。我做了点什么 var oTable; $("#customerdata tbody").click(function(event) { $(oTable.fnSettings().aoData).each(function (){ $(this.nTr).removeClass('row_selected'); });

如何使用键盘箭头键操作datatable(jquery插件)行。我做了点什么

var oTable;
    $("#customerdata tbody").click(function(event) {
            $(oTable.fnSettings().aoData).each(function (){
                    $(this.nTr).removeClass('row_selected');
            });
            var row = $(event.target.parentNode);
            row.addClass('row_selected');
            var custid=row.find('td:first').text();
            if(custid!="No data available in table"){
                $('#cust_id').val(custid);
            $('#customerdata_filter input').val('');
            $("#editmodal").dialog("close");}
    });        

    oTable = $("#customerdata").dataTable({
    "bJQueryUI": true,
            "bLengthChange": false,
            "bPaginate": false,
    "sPaginationType": "full_numbers",
            "bProcessing": true,
    "bServerSide": true,
            "sScrollY": "260px",
    "sAjaxSource": "/SrikanthTest/customer.do?type=showMinCustomerDetails"
});
但我不知道如何在行上操作光标。


我想你正在寻找这样的东西,但我需要更多的背景来确定

$(document).keydown(function (event) {
    switch(event.keyCode)
    {
        var currentRow = $(".row_selected").get(0);
        //arrow down
        case 40:
            $(currentRow).next().addClass("row_selected");
            $(currentRow).removeClass("row_selected");
            break;
        //arrow up
        case 38:
            $(currentRow).prev().addClass("row_selected");
            $(currentRow).removeClass("row_selected");
            break;

    }
});

我已经发布了一个示例,该示例也适用于动态加载的分页表


然而,我已经使用了tab键来提高可用性。我相信用一个换另一个很容易

你可能会对同一位作者的一个插件感兴趣,它叫KeyTable