Sortable List and Table Rows

Funny little quirk I just encountered, and I wanted to post it where you might find it one day. If you're using the Proto/Scripty sortable helper in Rails, and you want to sort a table, you need to put the HTML ID that you use to identify your list collection on the tbody tag, not the table itself. It's the difference between this:

<table id="sort_list"> <thead> </thead> <tbody> <tr id="id_<%= %>"> ...</tr> ... </tbody> </table>

...which doesn't work at all, but doesn't throw any JavaScript errors, and this:

<table> <thead> </thead> <tbody id="sort_list"> <tr id="id_<%= %>"> ...</tr> ... </tbody> </table>

...which works perfectly.

The same helper tag in either case:

<%= sortable_element 'sort_list', :url => { :id =>, :action => "sort_team" }, :tag => 'tr', :complete => visual_effect(:highlight, 'sort_list') %>

Hope this keeps someone else from panicking.