Rails 3.1.x - jquery
drag_drop.js
$(function() {
$( “[id^=moveable]” ).draggable();
$( “#droppable2” ).droppable({
drop: function( event, ui ) {
$( this )
.addClass( “ui-state-highlight” )
$.post( “groups/add_member/”, { “add”: ui.draggable.text() },
function(data) {
$(‘#member_management’).html(data) } );
}
});
});
The controller does “render :partial => ‘memberships’” and my
memberships.js.erb has
$(‘#memberships’).load(“<%= escape_javascript(render(:partial =>
“memberships”, :object => @group)) %>”);
Works - well, I still need a way to pass @group instance variable in the
‘post’ string back to controller but in the meantime, I am stuck in that
after the first drag/drop/update I can’t do more drag and drop
apparently because the drag_drop.js code needs to run again after the
partial refresh.
How do I get this to execute again or must I necessarily embed the
script in the memberships.js.erb ?
–
Craig W. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[email protected]
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
www.ttiassessments.com
Need help communicating between generations at work to achieve your
desired success? Let us help!