Hello all,
I have 2 sortables that the user should be able to drag and drop
elements between. I want an event to fire when an element is dropped
and I want to capture the id of the container (droppable) and id of
the dropped item (draggable). However I also want it to be sortable
(hence needing to use a Sortable vs. Draggable/Droppables).
The onDrop event on Droppable looked like a good candidate. I added
it as a Prototype.emptyFunction to the options hash and passed on the
definition through the rails method:
sortable_element("container_1", ..., :onDrop =>
"function(drag, drop,
event) { alert(drop.id); }", ...);
I do this for both containers, obviously setting the
''containment''
option among other things.
I add onDrop as one of the options_for_droppable as well as
options_for_tree:
var options_for_droppable = {
...
onDrop: options.onDrop
}
In summary, it seems to work, *except* that it only works some of the
time. Some elements when dropped to not fire off the onDrop event
while other elements will always fire it off. Anyone know what the
deal is? I have tried getting rid of the sortable and just using
Droppables to test the onDrop firing there and it seems to work
without problems. It seems that the problem occurs when the sortable
tries to create droppables internally. Apologies for the long
message, just trying to be as specific and clear as possible.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---