"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?


I did a search on Google and came across this site

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