"Best Practice" for Expand/Collapse a Table...

Is there a "best practice" for making a table expandable/collapsible.
Basically, I want my html table to support expand/collapse using a
"gem"? Ideally, I want to be able to sort as well.

Any suggestions?

Thanks,
Jason

I did a search on Google and came across this site http://dev.nozav.org/rails_ajax_table.html

It shows “How to paginate, sort and search a table with Ajax and Rails”