Got a response:
$('table tbody').on('click', 'tr', function(e){
if(e.ctrlKey || e.metaKey){
$(this).toggleClass('selected');
}else{
$(this).addClass('selected').siblings().removeClass('selected');
}
}).sortable({
items: 'tr:not(tr:first-child)',
connectWith: 'table',
cursor: 'move',
delay: 150,
revert: 0,
helper: function(e, item){
if(!item.hasClass('selected')){
item.addClass('selected').siblings().removeClass('selected');
}
var elements = item.parent().children('.selected').clone();
item.data('multidrag', elements).siblings('.selected').remove();
var helper = $('<tr/>');
return helper.append(elements);
},
stop: function(e, ui){
var elements = ui.item.data('multidrag');
ui.item.after(elements).remove();
}
});
table tbody{
background-color: greenYellow;
}
table tbody th{
background-color: green;
}
.selected{
background-color: Azure;
}
Updated Fiddle Here
source
share