Rail 2.2 Sort multiple Columns in report

My end user would like a report on a single page that he can select the header field and sort by that.

First all the data is laid out in a table. Then each row is a different user record.

Name State Zip Points

Any tips on how I could allow the user to click an ASC or DESC arrow next to each Column to sort the page?

I am only working with about 75 user records now, but understand it may grow in which case I will be using the wil_paginate plugin so please keep that in mind for the advice.

I was looking at sortable_column_headers, but told it is not supported in rails 2.2.

Thanks in advance.

Ian

Ian H Stewart wrote:

My end user would like a report on a single page that he can select the header field and sort by that.

Wouldn't you just need to construct an "order by" clause and use that when you find the records?

@users = User.find(:all, :order => "state, points DESC")

I might even suggest updating the list through AJAX, but that's not required if you don't mind a page refresh when selecting sorting controls. You'll, of course, need to keep track of the storing state between requests, which you could do using the session, or any number of others common techniques.