public/javascripts/yui/datatable/datatable.js
function(row) {
    var oRecord, elRow;

    if(row instanceof YAHOO.widget.Record) {
        oRecord = this._oRecordSet.getRecord(row);
        elRow = this.getTrEl(oRecord);
    }
    else if(lang.isNumber(row)) {
        oRecord = this.getRecord(row);
        elRow = this.getTrEl(oRecord);
    }
    else {
        elRow = this.getTrEl(row);
        oRecord = this.getRecord(elRow);
    }

    if(oRecord) {
        // Update selection trackers
        var tracker = this._aSelections || [];
        var sRecordId = oRecord.getId();
        var index = -1;

        // Remove if already there:
        // Use Array.indexOf if available...
        /*if(tracker.indexOf && (tracker.indexOf(sRecordId) >  -1)) {
            tracker.splice(tracker.indexOf(sRecordId),1);
        }*/
        if(tracker.indexOf) {
            index = tracker.indexOf(sRecordId);
            
        }
        // ...or do it the old-fashioned way
        else {
            for(var j=tracker.length-1; j>-1; j--) {
                if(tracker[j] === sRecordId){
                    index = j;
                    break;
                }
            }
        }
        if(index > -1) {
            tracker.splice(index,1);
        }
        
        // Add to the end
        tracker.push(sRecordId);
        this._aSelections = tracker;

        // Update trackers
        if(!this._oAnchorRecord) {
            this._oAnchorRecord = oRecord;
        }

        // Update UI
        if(elRow) {
            Dom.addClass(elRow, DT.CLASS_SELECTED);
        }

        this.fireEvent("rowSelectEvent", {record:oRecord, el:elRow});
    }
    else {
    }
}
function(row) {
    var oRecord, elRow;

    if(row instanceof YAHOO.widget.Record) {
        oRecord = this._oRecordSet.getRecord(row);
        elRow = this.getTrEl(oRecord);
    }
    else if(lang.isNumber(row)) {
        oRecord = this.getRecord(row);
        elRow = this.getTrEl(oRecord);
    }
    else {
        elRow = this.getTrEl(row);
        oRecord = this.getRecord(elRow);
    }

    if(oRecord) {
        // Update selection trackers
        var tracker = this._aSelections || [];
        var sRecordId = oRecord.getId();
        var index = -1;

        // Remove if already there:
        // Use Array.indexOf if available...
        /*if(tracker.indexOf && (tracker.indexOf(sRecordId) >  -1)) {
            tracker.splice(tracker.indexOf(sRecordId),1);
        }*/
        if(tracker.indexOf) {
            index = tracker.indexOf(sRecordId);
            
        }
        // ...or do it the old-fashioned way
        else {
            for(var j=tracker.length-1; j>-1; j--) {
                if(tracker[j] === sRecordId){
                    index = j;
                    break;
                }
            }
        }
        if(index > -1) {
            tracker.splice(index,1);
        }
        
        // Add to the end
        tracker.push(sRecordId);
        this._aSelections = tracker;

        // Update trackers
        if(!this._oAnchorRecord) {
            this._oAnchorRecord = oRecord;
        }

        // Update UI
        if(elRow) {
            Dom.addClass(elRow, DT.CLASS_SELECTED);
        }

        this.fireEvent("rowSelectEvent", {record:oRecord, el:elRow});
    }
    else {
    }
}
function ( row ) { var oRecord , elRow ; if ( row instanceof YAHOO . widget . Record ) { oRecord = this . _oRecordSet . getRecord ( row ) ; elRow = this . getTrEl ( oRecord ) ; } else if ( lang . isNumber ( row ) ) { oRecord = this . getRecord ( row ) ; elRow = this . getTrEl ( oRecord ) ; } else { elRow = this . getTrEl ( row ) ; oRecord = this . getRecord ( elRow ) ; } if ( oRecord ) { // Update selection trackers var tracker = this . _aSelections || [ ] ; var sRecordId = oRecord . getId ( ) ; var index = - 1 ; // Remove if already there: // Use Array.indexOf if available... /*if(tracker.indexOf && (tracker.indexOf(sRecordId) >  -1)) {
            tracker.splice(tracker.indexOf(sRecordId),1);
        }*/ if ( tracker . indexOf ) { index = tracker . indexOf ( sRecordId ) ; } // ...or do it the old-fashioned way else { for ( var j = tracker . length - 1 ; j > - 1 ; j -- ) { if ( tracker [ j ] === sRecordId ) { index = j ; break ; } } } if ( index > - 1 ) { tracker . splice ( index , 1 ) ; } // Add to the end tracker . push ( sRecordId ) ; this . _aSelections = tracker ; // Update trackers if ( ! this . _oAnchorRecord ) { this . _oAnchorRecord = oRecord ; } // Update UI if ( elRow ) { Dom . addClass ( elRow , DT . CLASS_SELECTED ) ; } this . fireEvent ( "rowSelectEvent" , { record : oRecord , el : elRow } ) ; } else { } }
Sets given row to the selected state.

@method selectRow
@param row {HTMLElement | String | YAHOO.widget.Record | Number} HTML element
reference or ID string, Record instance, or RecordSet position index.
Sets given row to the selected state .