OT :JavascriptSortableTables

I found this on the rails wiki http://www.kryogenix.org/code/browser/sorttable/ Looked farily easy, class and id for the table. Dropped the JS in to application.js . Problem is it’s putting the sort link on the first row of data and not on

Anyone know how to fix it ? Here’s a bit of my table:

........................ <% for position in @positions %>
Date Reference Number Title Company
<%= position.start_on_date. ..................

Here's my own: http://phrogz.net/tmp/TableSort/

See also the separate library for auto-linking/auto-highlighting rows: http://phrogz.net/JS/rowlinkage_js.txt

Dark Ambient wrote:

I found this on the rails wiki sorttable: Make all your tables sortable Looked farily easy, class and id for the table. Dropped the JS in to application.js . Problem is it's putting the sort link on the first row of data and not on <thead>

Anyone know how to fix it ? Here's a bit of my table:

<table class="sortable" id="poso"> <thead>

<th style="white-space: nowrap">Date</th> <th style="white-space: nowrap">Reference Number</th> <th style="white-space: nowrap">Title</th> <th style="white-space: nowrap">Company</th> ........................ </thead>

<tbody> <tr> <% for position in @positions %> <td style="white-space: nowrap"><%= position.start_on_date. .................. </table>

Add a <tr> around your <th>s.