Quick Sort Tables

Tablesorter is a jQuery plugin which can re-order HTML tables client-side. This has large speed benefits but the speed does decrease with tables in excess of 5,000 rows.

Using

  1. In the <HEAD> section: <script type="text/javascript" src="../js/jquery_tablesorter/jquery.tablesorter.js"></script>
  2. Give the table an ID
  3. Give the table class of: tablesorter
  4. In the <SCRIPT> section include:
 $(function () {
      if ($("#maindata").find("tr").size() > 1) {
        $("#maindata").tablesorter({ 
          sortList: [[0,0]] 
        });
      }
  }

 

 

What this will do is on document ready will order the first column of the table with ID 'maindata'.

Note

In Rogo 6.0 if you are order by date columns then you will also need to following setting before the sortList in the tablesorter jquery function:

dateFormat: '<?php echo $configObject->get('cfg_tablesorter_date_time'); ?>',