I have two sortable list that a user can drag and drop to and from. I
want to store the new order in the database.
What I am having problems with is I am using the onUpdate callback
function to make an Ajax request to my action that stores the new
order. I am unsure if I should put the onUpdate call in both of the
sortable.create functions.
If I put the callback in the first sortable, I can drag and drop to
and from and the order is stored correctly, I can sort the sortable
with the callback but I can not sort the sortable without the
callback.
Sortable.create("left",
{dropOnEmpty:true,containment:["left","right"],constraint:false,
onUpdate:updateOrder});
Sortable.create("right",
{dropOnEmpty:true,containment:
["left","right"],constraint:false});
If I put the callback in the second sortable nothing works.
Sortable.create("left",
{dropOnEmpty:true,containment:
["left","right"],constraint:false});
Sortable.create("right",
{dropOnEmpty:true,containment:["left","right"],constraint:false,
onUpdate:updateOrder});
If I put the callback in the both sortables then the ordering does
not get saved properly.
Sortable.create("left",
{dropOnEmpty:true,containment:["left","right"],constraint:false,
onUpdate:updateOrder});
Sortable.create("right",
{dropOnEmpty:true,containment:["left","right"],constraint:false,
onUpdate:updateOrder});
function updateOrder(){
var left_list = Sortable.serialize(''left'');
var right_list = Sortable.serialize(''right'');
var url = ''order_modules'';
var params = left_list + ''&'' + right_list;
new Ajax.Request(url, {
method: ''post'',
parameters: params});
}
So should the callback go in both sortables and my saving algorithm is
wrong or should the callback only go in one of the sortables? Or ???
Thanks, K
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---