title: Default secondary sort
body: <p>I need to setup multi column sorting on a table of account transactions. I've decided to go with jQuery DataTables. Whenever I click a column header to sort that column (say column x), I want it to sort by column 3 for any matches in column x. If I click column 3, then it should sort by column 0 when there are matches in column 3.</p>
  
  <p>I've seen <a href="http://datatables.net/ref#fnSortListener" rel="nofollow">fnSortListener</a> and <a href="http://datatables.net/ref#fnSort" rel="nofollow">fnSort</a>, and it looks like I could accomplish my goal by attaching these to each column... but that seems really redundant, since every column needs to do its secondary sort on column 3, except for column 3.</p>
  
  <p>So, is there a way to tell DataTables to always do a secondary sort on column 3 and then specify the exception for column 3?</p>
  
  <p>Any help is appreciated. I'm very new to this plugin. Thanks!</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Here's what I wound up going with. The first 2D array indicates how to sort on first click, and the second 2d array indicates how to sort on second click.</p>
  
  <pre><code>var Sorter = function($dataTable) {
    return {
      bindMultiSort: function(headerSelector, firstOrderTuples, secondOrderTuples) {
        var order = 0;
        this.removeSorting(headerSelector).click(function() {
          if (order === 0) {
            $dataTable.fnSort(firstOrderTuples);
            order = 1;
          } else {
            $dataTable.fnSort(secondOrderTuples);
            order = 0;
          }   
        }); 
      },  
  
      removeSorting: function(headerSelector) {
        var $header = $(headerSelector);
        $header.unbind('click');
  
        return $header;
      }   
    };  
  };
  
    function attachSecondarySorting($transactionsTable) {
        var sorter = new Sorter($transactionsTable);
        sorter.bindMultiSort('#posted', [[POSTED_DATE_COL, "asc"], [DESCRIPTION_COL, "asc"]], [[POSTED_DATE_COL, "desc"], [DESCRIPTION_COL, "asc"]]);
        sorter.bindMultiSort('#received', [[RECEIVED_DATE_COL, 'asc'], [DESCRIPTION_COL, 'asc']], [[RECEIVED_DATE_COL, 'desc'], [DESCRIPTION_COL, 'asc']]);
        sorter.bindMultiSort('#category', [[TRANSACTION_TYPE_COL, 'asc'], [POSTED_DATE_COL, 'desc'], [DESCRIPTION_COL, 'asc']], [[TRANSACTION_TYPE_COL, 'desc'],
        sorter.bindMultiSort('#description', [[DESCRIPTION_COL, 'asc'], [POSTED_DATE_COL, 'desc']], [[DESCRIPTION_COL, 'desc'], [POSTED_DATE_COL, 'desc']]);    
        sorter.bindMultiSort('#moneyIn', [[MONEY_IN_COL, 'asc'], [DESCRIPTION_COL, 'asc']], [[MONEY_IN_COL, 'desc'], [DESCRIPTION_COL, 'asc']]);
        sorter.bindMultiSort('#moneyOut', [[MONEY_OUT_COL, 'asc'], [DESCRIPTION_COL, 'asc']], [[MONEY_OUT_COL, 'desc'], [DESCRIPTION_COL, 'asc']]);      
    }
  </code></pre>