Latest Posts

Sorting tables - without the SQL Order By

Posted on July 31, 2006, under Random | 5239 Views

A quick and easy way to add sort capabilities to your tables without return calls to your DB. Reference: http://kryogenix.org/code/browser/sorttable/

The largest table I have this one is 6 columns, 300 rows.

Example:

Employee PayScale Hiring Date
John Smith $25,000 4/18/1997
Betty Rubble $28,500 5/12/2003
Fred Flintstone $18,000 12/25/1901
Bam Bam $99,999 7/31/2006



Source:

<InvalidTag src="sorttable.js"></script>
<table class="sortable" id="uniqueIDhere">
<tr>
   <td>Employee</td>
   <td>PayScale</td>
   <td>Hiring Date</td>
</tr>   

<tr>
   <td>John Smith</td>
   <td>25,000</td>
   <td>1/1/1997</td>
</tr>   
<tr>
   <td>Betty Rubble</td>
   <td>28,500</td>
   <td>5/12/2003</td>
</tr>   
<tr>
   <td>Fred Flintstone</td>
   <td>18,000</td>
   <td>12/25/1901</td>
</tr>   
<tr>
   <td>Bam Bam</td>
   <td>99,999</td>
   <td>7/31/2006</td>
</tr>   

</table>