public/javascripts/yui/datatable/datatable.js
function(e) {
    var nKey = Ev.getCharCode(e);
    if((nKey == 9) || ((nKey > 36) && (nKey < 41))) {
        var bSHIFT = e.shiftKey;

        // Validate trigger
        var oTrigger = this._getSelectionTrigger();
        // Arrow selection only works if last selected row is on current page
        if(!oTrigger) {
            return null;
        }

        // Determine the new cell to select
        var elNew;
        if(nKey == 40) { // Arrow down
            elNew = this.getBelowTdEl(oTrigger.el);

            // Validate new cell
            if(elNew === null) {
                //TODO: wrap around to first tr on current page

                //TODO: wrap forward to first tr of next page

                // Bottom selection is sticky
                elNew = oTrigger.el;
            }
        }
        else if(nKey == 38) { // Arrow up
            elNew = this.getAboveTdEl(oTrigger.el);

            // Validate new cell
            if(elNew === null) {
                //TODO: wrap around to last tr on current page

                //TODO: wrap back to last tr of previous page

                // Top selection is sticky
                elNew = oTrigger.el;
            }
        }
        else if((nKey == 39) || (!bSHIFT && (nKey == 9))) { // Arrow right or tab
            elNew = this.getNextTdEl(oTrigger.el);

            // Validate new cell
            if(elNew === null) {
                //TODO: wrap around to first td on current page

                //TODO: wrap forward to first td of next page

                // Top-left selection is sticky, and release TAB focus
                //elNew = oTrigger.el;
                return;
            }
        }
        else if((nKey == 37) || (bSHIFT && (nKey == 9))) { // Arrow left or shift-tab
            elNew = this.getPreviousTdEl(oTrigger.el);

            // Validate new cell
            if(elNew === null) {
                //TODO: wrap around to last td on current page

                //TODO: wrap back to last td of previous page

                // Bottom-right selection is sticky, and release TAB focus
                //elNew = oTrigger.el;
                return;
            }
        }

        Ev.stopEvent(e);
        
        // Unselect all cells
        this.unselectAllCells();

        // Select the new cell
        this.selectCell(elNew);

        // Set new anchor
        this._oAnchorCell = {record:this.getRecord(elNew), column:this.getColumn(elNew)};
    }
}
function(e) {
    var nKey = Ev.getCharCode(e);
    if((nKey == 9) || ((nKey > 36) && (nKey < 41))) {
        var bSHIFT = e.shiftKey;

        // Validate trigger
        var oTrigger = this._getSelectionTrigger();
        // Arrow selection only works if last selected row is on current page
        if(!oTrigger) {
            return null;
        }

        // Determine the new cell to select
        var elNew;
        if(nKey == 40) { // Arrow down
            elNew = this.getBelowTdEl(oTrigger.el);

            // Validate new cell
            if(elNew === null) {
                //TODO: wrap around to first tr on current page

                //TODO: wrap forward to first tr of next page

                // Bottom selection is sticky
                elNew = oTrigger.el;
            }
        }
        else if(nKey == 38) { // Arrow up
            elNew = this.getAboveTdEl(oTrigger.el);

            // Validate new cell
            if(elNew === null) {
                //TODO: wrap around to last tr on current page

                //TODO: wrap back to last tr of previous page

                // Top selection is sticky
                elNew = oTrigger.el;
            }
        }
        else if((nKey == 39) || (!bSHIFT && (nKey == 9))) { // Arrow right or tab
            elNew = this.getNextTdEl(oTrigger.el);

            // Validate new cell
            if(elNew === null) {
                //TODO: wrap around to first td on current page

                //TODO: wrap forward to first td of next page

                // Top-left selection is sticky, and release TAB focus
                //elNew = oTrigger.el;
                return;
            }
        }
        else if((nKey == 37) || (bSHIFT && (nKey == 9))) { // Arrow left or shift-tab
            elNew = this.getPreviousTdEl(oTrigger.el);

            // Validate new cell
            if(elNew === null) {
                //TODO: wrap around to last td on current page

                //TODO: wrap back to last td of previous page

                // Bottom-right selection is sticky, and release TAB focus
                //elNew = oTrigger.el;
                return;
            }
        }

        Ev.stopEvent(e);
        
        // Unselect all cells
        this.unselectAllCells();

        // Select the new cell
        this.selectCell(elNew);

        // Set new anchor
        this._oAnchorCell = {record:this.getRecord(elNew), column:this.getColumn(elNew)};
    }
}
function ( e ) { var nKey = Ev . getCharCode ( e ) ; if ( ( nKey == 9 ) || ( ( nKey > 36 ) && ( nKey < 41 ) ) ) { var bSHIFT = e . shiftKey ; // Validate trigger var oTrigger = this . _getSelectionTrigger ( ) ; // Arrow selection only works if last selected row is on current page if ( ! oTrigger ) { return null ; } // Determine the new cell to select var elNew ; if ( nKey == 40 ) { // Arrow down elNew = this . getBelowTdEl ( oTrigger . el ) ; // Validate new cell if ( elNew === null ) { //TODO: wrap around to first tr on current page //TODO: wrap forward to first tr of next page // Bottom selection is sticky elNew = oTrigger . el ; } } else if ( nKey == 38 ) { // Arrow up elNew = this . getAboveTdEl ( oTrigger . el ) ; // Validate new cell if ( elNew === null ) { //TODO: wrap around to last tr on current page //TODO: wrap back to last tr of previous page // Top selection is sticky elNew = oTrigger . el ; } } else if ( ( nKey == 39 ) || ( ! bSHIFT && ( nKey == 9 ) ) ) { // Arrow right or tab elNew = this . getNextTdEl ( oTrigger . el ) ; // Validate new cell if ( elNew === null ) { //TODO: wrap around to first td on current page //TODO: wrap forward to first td of next page // Top-left selection is sticky, and release TAB focus //elNew = oTrigger.el; return ; } } else if ( ( nKey == 37 ) || ( bSHIFT && ( nKey == 9 ) ) ) { // Arrow left or shift-tab elNew = this . getPreviousTdEl ( oTrigger . el ) ; // Validate new cell if ( elNew === null ) { //TODO: wrap around to last td on current page //TODO: wrap back to last td of previous page // Bottom-right selection is sticky, and release TAB focus //elNew = oTrigger.el; return ; } } Ev . stopEvent ( e ) ; // Unselect all cells this . unselectAllCells ( ) ; // Select the new cell this . selectCell ( elNew ) ; // Set new anchor this . _oAnchorCell = { record : this . getRecord ( elNew ) , column : this . getColumn ( elNew ) } ; } }
Determines selection behavior resulting from a key event when selection mode
is set to "singlecell".

@method _handleSingleCellSelectionByKey
@param e {HTMLEvent} Event object.
@private
Determines selection behavior resulting from a key event when selection mode is set to singlecell .