How to update ranking in sortable elements?

hey all,
I have a sortable list like that:


    <% 6.times do |i| -%> <%= i+1 %>
  • I'm number <%= i+1 %>
  • <% end -%>

<%= sortable_element ‘list’,
:update => ‘list-info’,
:complete => visual_effect(:highlight, ‘list’),
:url => { :action => “order” } %>


def order
@order = params[:list]
render :partial => ‘list’

I would like to update the position number in the span item_position
as I drag and drop elements. As an exemple, if I drag element number 5
to the second position I would like to update its span to 2.

Any idea how to do that?

thanx in advance