-
section_browse.msn
842 843 240 240 if ( sourceID == targetID ) { 241 241 return; 242 242 } 243 var checkedIds = []; 244 $('tr.data-row').each(function(index){ 245 $checkInput = $(this).find('.common-check'); 246 if ( $(this).data('id') == sourceID ) { 247 checkedIds.push($(this).data('id')); 248 $checkInput.prop('checked', true); 249 } else if ( $checkInput.prop('checked') ) { 250 checkedIds.push($(this).data('id')); 251 } 252 }); 253 if ( sourceID != checkedIds[0] ) { 254 $source = $('#row-' + checkedIds[0]); 255 } 243 256 $.ajax({ 244 257 'url' : '/contenido/ajax/document_move.html', 245 'data' : { 's' : <% ref $section ? $section->id : 0 %>, 'id' : sourceID, 'move' : 'after', 'aid' : targetID }, 258 'data' : { 's' : <% ref $section ? $section->id : 0 %>, 'id' : checkedIds.join(','), 'move' : 'after', 'aid' : targetID }, 246 259 'dataType' : 'json', 247 260 'success' : function( data ){ 248 261 if ( data.error ) { 249 262 alert( data.error ); 250 263 } else if ( data.after ) { 251 $source.detach().insertAfter($target); 264 checkedIds.forEach(function(rowID, index, ids) { 265 $source = $('#row-' + rowID); 266 $source.detach().insertAfter($target); 267 $source.find('.common-check').attr('checked', false); 268 $target = $source; 269 }); 252 270 console.log('Moved after ' + data.after); 253 271 } 254 272 }