public/javascripts/yui/datatable/datatable.js
function(oColumn, oSortedBy) {
    // Backward compatibility
    if(oColumn.sortOptions && oColumn.sortOptions.defaultOrder) {
        if(oColumn.sortOptions.defaultOrder == "asc") {
            oColumn.sortOptions.defaultDir = DT.CLASS_ASC;
        }
        else if (oColumn.sortOptions.defaultOrder == "desc") {
            oColumn.sortOptions.defaultDir = DT.CLASS_DESC;
        }
    }
    
    // What is the Column's default sort direction?
    var sortDir = (oColumn.sortOptions && oColumn.sortOptions.defaultDir) ? oColumn.sortOptions.defaultDir : DT.CLASS_ASC;

    // Is the Column currently sorted?
    var bSorted = false;
    oSortedBy = oSortedBy || this.get("sortedBy");
    if(oSortedBy && (oSortedBy.key === oColumn.key)) {
        bSorted = true;
        if(oSortedBy.dir) {
            sortDir = (oSortedBy.dir === DT.CLASS_ASC) ? DT.CLASS_DESC : DT.CLASS_ASC;
        }
        else {
            sortDir = (sortDir === DT.CLASS_ASC) ? DT.CLASS_DESC : DT.CLASS_ASC;
        }
    }
    return sortDir;
}
function(oColumn, oSortedBy) {
    // Backward compatibility
    if(oColumn.sortOptions && oColumn.sortOptions.defaultOrder) {
        if(oColumn.sortOptions.defaultOrder == "asc") {
            oColumn.sortOptions.defaultDir = DT.CLASS_ASC;
        }
        else if (oColumn.sortOptions.defaultOrder == "desc") {
            oColumn.sortOptions.defaultDir = DT.CLASS_DESC;
        }
    }
    
    // What is the Column's default sort direction?
    var sortDir = (oColumn.sortOptions && oColumn.sortOptions.defaultDir) ? oColumn.sortOptions.defaultDir : DT.CLASS_ASC;

    // Is the Column currently sorted?
    var bSorted = false;
    oSortedBy = oSortedBy || this.get("sortedBy");
    if(oSortedBy && (oSortedBy.key === oColumn.key)) {
        bSorted = true;
        if(oSortedBy.dir) {
            sortDir = (oSortedBy.dir === DT.CLASS_ASC) ? DT.CLASS_DESC : DT.CLASS_ASC;
        }
        else {
            sortDir = (sortDir === DT.CLASS_ASC) ? DT.CLASS_DESC : DT.CLASS_ASC;
        }
    }
    return sortDir;
}
function ( oColumn , oSortedBy ) { // Backward compatibility if ( oColumn . sortOptions && oColumn . sortOptions . defaultOrder ) { if ( oColumn . sortOptions . defaultOrder == "asc" ) { oColumn . sortOptions . defaultDir = DT . CLASS_ASC ; } else if ( oColumn . sortOptions . defaultOrder == "desc" ) { oColumn . sortOptions . defaultDir = DT . CLASS_DESC ; } } // What is the Column's default sort direction? var sortDir = ( oColumn . sortOptions && oColumn . sortOptions . defaultDir ) ? oColumn . sortOptions . defaultDir : DT . CLASS_ASC ; // Is the Column currently sorted? var bSorted = false ; oSortedBy = oSortedBy || this . get ( "sortedBy" ) ; if ( oSortedBy && ( oSortedBy . key === oColumn . key ) ) { bSorted = true ; if ( oSortedBy . dir ) { sortDir = ( oSortedBy . dir === DT . CLASS_ASC ) ? DT . CLASS_DESC : DT . CLASS_ASC ; } else { sortDir = ( sortDir === DT . CLASS_ASC ) ? DT . CLASS_DESC : DT . CLASS_ASC ; } } return sortDir ; }
For the given Column instance, returns next direction to sort.

@method getColumnSortDir
@param oColumn {YAHOO.widget.Column} Column instance.
@param oSortedBy {Object} (optional) Specify the state, or use current state.
@return {String} YAHOO.widget.DataTable.CLASS_ASC or YAHOO.widget.DataTableCLASS_DESC.
For the given Column instance returns next direction to sort .