Hi people, ive been searching for a while and i cant find a solution for
this, im making a todo list with sortable items(and updated its position
on the server), it works very good when i have only one list but when i
have more than one the items are sorted in the view but not get
updated(at least all but one) and ill try to explain why so hope you can
give me a hand:
On the view i have this(all working):
<% for list in @lists %>
<ul id="listAjax<%= list.id %>">
<% for todo in list.todos.sort{|a,b| a.position <=> b.position}
%>
<li id="item_<%= todo.id %>">
<%= todo.content %>
</li>
<% end %>
</ul>
<script type="text/javascript">
//<![CDATA[
Sortable.create("listAjax<%= list.id %>",
{onUpdate:function(){new
Ajax.Request(''/todos/repeat'', {asynchronous:true,
evalScripts:true,
onComplete:function(request){alert(request.responseText);},
parameters:Sortable.serialize("listAjax<%= list.id %>")})}})
//]]>
</script>
<% end %>
Notice that im using above: Sortable.create("listAjax<%= list.id
%>" ...
that way the lists are named diferently, non repeated with its id.
An in the controller i catch the para meters like this:
order = params[:listAjax]
#all the rest of the ordering process...
So here its the problem the lists are generated like this:
<ul id="listAjax1">...
<ul id="listAjax2">...
<ul id="listAjax3">...
when theres just one list i can cath its parameters with(for the first):
order = params[:listAjax1]
but when theres more list i dont know how, so the main question is, how
i can cath the parameters of the multiple lists(one at the time of
course while reordering its items) in the controller so i can update
them?
Any help, really cause this its driving me nuts.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---