Norm212
Norm212

Reputation: 974

Why doesn't my sorting method get called?

This is my code:

<table border="1" id="champs">
<tbody id="item-list-body">
<tr class="champ" id="view-item-<%= champ.id %>">
<td class="drag_handle">[Déplacer]</td>
</tbody>
</table>
<%= sortable_element('item-list-body',:url => sort_update_path, :tag =>:tr, :handle => :drag_handle) %>

I am able to sort, but the method sort_update are never call.

I use Rails 3.0.7 and Ruby 1.9.2

Upvotes: 0

Views: 75

Answers (2)

tybro0103
tybro0103

Reputation: 49713

It's very particular about the elements' ID's. It has to be in the format of string_integer.

Try changing to:

<tr class="champ" id="view_<%= champ.id %>">

And as mentioned, close the tr

Upvotes: 1

Heikki
Heikki

Reputation: 15417

You are not closing the tr tag. I'm also wondering how you can sort a list which includes only one item.

Upvotes: 0

Related Questions