Hi.
I’ve realised this example and it works great :
http://demo.script.aculo.us/ajax/sortable_elements
But i want to add to the user the capability to add items to the
sortable list.
Here is my code :
#######################
#list_controller.rb :
#######################
class ListController < ApplicationController
def index
@elements = [“toto”, “titi”, “tata”, “riri”, “fifi”, “loulou”]
end
def order
@order = params[:list]
render :partial => ‘list’
end
end
#######################
#index.rhtml :
#######################
-
<% 6.times do |i| -%>
- I'm number <%= i+1 %> <% end -%>
<%= sortable_element ‘list’,
:update => ‘list-info’,
:complete => visual_effect(:highlight, ‘list’),
:url => { :action => “order” } %>
#######################
#_list.rhtml
#######################
Updated order is: <%= @order.join(', ') %>.
The trouble is that added elements couldn’t be sorted. Is there a way to
“refresh” the sortable_element method please ?
Thanks in advance.