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 <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> -- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Dark Ambient wrote:> 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 <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. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---