Search code examples
javascripttablesorter

Tablesorter sortList Malfunction?


Tablesorter sortList Malfunction?

why cannot i set an initial column sort order with sortList?

$(function(){
  $("#myTable").tablesorter({ 
    sortList : [[4,1]], // initial sort columns (2nd and 3rd)
    cssInfoBlock : "tablesorter-no-sort"
  });
});

Can anyone tell me why please?


Solution

  • Using [[4,1]] will sort the 5th column (it uses a zero-base index).

    Instead try this code (demo):

    $(function(){
      $("#myTable").tablesorter({
        sortList : [[1,1],[2,1]], // initial sort columns (2nd and 3rd)
        cssInfoBlock : "tablesorter-no-sort"
      });
    });