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:

... ...

…which doesn’t work at all, but doesn’t throw any JavaScript errors,
and this:

... ...

…which works perfectly.

The same helper tag in either case:

<%= sortable_element ‘sort_list’,
:url => { :id => @campaign.id, :action => “sort_team” },
:tag => ‘tr’,
:complete => visual_effect(:highlight, ‘sort_list’)
%>

Hope this keeps someone else from panicking.

Walter

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs