
sortable_element with table
März 24, 2009
<table class="listing">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody id="project_versions">
<% for item in project_versions %>
<% content_tag_for(:tr, item) do %>
<td class="drag_handle">[drag]</td>
<td><%= h item.name -%></span>
<% end %>
<% end %>
<%= sortable_element('project_versions', :url => {:controller => 'project', :action => 'sort_project_version'}, :handle => :drag_handle, :tag => :tr) %>
Without many words, i hope the code speaks for itself.
Take care of the :tag attriubte in the helper (default is li) and the container has to be the tbody.
Thanks man, exactly what I was looking for, you’ve spared me a headache