Index: section_browse.msn =================================================================== --- section_browse.msn (revision 842) +++ section_browse.msn (revision 843) @@ -240,15 +240,33 @@ if ( sourceID == targetID ) { return; } + var checkedIds = []; + $('tr.data-row').each(function(index){ + $checkInput = $(this).find('.common-check'); + if ( $(this).data('id') == sourceID ) { + checkedIds.push($(this).data('id')); + $checkInput.prop('checked', true); + } else if ( $checkInput.prop('checked') ) { + checkedIds.push($(this).data('id')); + } + }); + if ( sourceID != checkedIds[0] ) { + $source = $('#row-' + checkedIds[0]); + } $.ajax({ 'url' : '/contenido/ajax/document_move.html', - 'data' : { 's' : <% ref $section ? $section->id : 0 %>, 'id' : sourceID, 'move' : 'after', 'aid' : targetID }, + 'data' : { 's' : <% ref $section ? $section->id : 0 %>, 'id' : checkedIds.join(','), 'move' : 'after', 'aid' : targetID }, 'dataType' : 'json', 'success' : function( data ){ if ( data.error ) { alert( data.error ); } else if ( data.after ) { - $source.detach().insertAfter($target); + checkedIds.forEach(function(rowID, index, ids) { + $source = $('#row-' + rowID); + $source.detach().insertAfter($target); + $source.find('.common-check').attr('checked', false); + $target = $source; + }); console.log('Moved after ' + data.after); } }