From here:
View:
Do whatever you need. The id is passed in params[:dropid]. See views/keywords/_show_key.html.erb and controllers/keyword_controller.rb for illustration of how to use it.
Note:
There is an issue with dragging and dropping across divs that have overflow:auto on
[1],[2]
This can be fixed by setting :ghosting=>true in the draggable.
View:
<% element_to_drag_id = "item_#{item.id}" %> <div id=<%= element_to_drag_id %> class='mydrop'>
Whatever </div> <%= draggable_element(element_to_drag_id, :revert=>true) %>
<% element_to_drop_id = "receiver" %> <div id=<%= element_to_drop_id %> > Whatever else </div>
<%= drop_receiving_element(element_to_drop_id, # The id of the receiving element :accept => "mydrop", # The CSS class of the dropped element :with => "'dropid=' + (element.id.split('_').last())", # The query string parameters :url => {:action=> 'dropped'} # The action to call )%>
Controller:
Do whatever you need. The id is passed in params[:dropid]. See views/keywords/_show_key.html.erb and controllers/keyword_controller.rb for illustration of how to use it.
Note:
There is an issue with dragging and dropping across divs that have overflow:auto on
[1],[2]
This can be fixed by setting :ghosting=>true in the draggable.
Comments
Post a Comment