# Sortable\_element -- need a strategy

**URL:** <https://www.ruby-forum.com/t/sortable-element-need-a-strategy/107465>\
**Category:** Rails\
**Created:** [June 22, 2007, 12:36am UTC](https://www.ruby-forum.com/t/sortable-element-need-a-strategy/107465 "2007-06-22T00:36:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![charlie\_caroff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a587f6/32.png) [@charlie\_caroff](https://www.ruby-forum.com/u/charlie_caroff)\
**Post date:** [June 22, 2007, 12:36am UTC](https://www.ruby-forum.com/t/sortable-element-need-a-strategy/107465/1 "2007-06-22T00:36:00Z")

</div>

Hi,

I have listings that are numbered. When I re-sort them, the first  
page of results re-sorts fine in the database, but the second page is  
ignored. How do I renumber all listings?

Also, though the first page is re-sorted fine in the database,  
listings numbers do not update on the page. I’m inclined to have  
an .rjs file that does a replace\_html on all listings, but it would be  
so much less data simply to have the listing numbers update.

Here is my code. The :after part is not working. redraw\_listings is  
an rjs that replaces all listings with the partial that creates them.

\<%= sortable\_element(‘listing’, :tag =\> “div”, :constraint =\>  
false, :scroll =\> :window,  
:url =\> { :action =\> “sort\_by\_position” , :id =\>  
@search\_term.id }, :containment =\> [‘listing’], :after =\> { :action =\>  
‘redraw\_listings’} ) %\>

Any hints?

Thanks,

Charlie
