Draggable_element: How to get id of dragged element, AND rec

Hey :slight_smile:

I’m creating a drag-and-drop tree structure using draggable_element. I
use this code,

<%=
draggable_element(content_element_id, :ghosting=>true, :revert=>true)
%>

<%= drop_receiving_element(content_element_id,
:accept => ‘tree_item’,
:complete => “$
(’#{content_element_id}_activity_indicator’).hide();”,
:before => “$
(’#{content_element_id}activity_indicator’).show();",
:hoverclass => ‘hovering’,
:with => "‘child_id=’ +
encodeURIComponent(element.id.split(’
’).last())”,
:url => { :action => :adopt } ) %>

This way, I can send the id of the element that is being dragged, to
the :adopt action in my controller. But I need to know which element
the dragged element was dropped upon, so it can be adopted by the
right parent.

Anybody know how I can do that?

Thanks in advance,
Daniel :slight_smile:

Ah, silly me :slight_smile:

Just have to add it to the drop_receiving_element call in :url!

                        :url        => { :action

=> :adopt, :parent_id => navigation_point.id } )%>

Cheers :slight_smile: