I'm using the sortable function that comes with jQuery UI to enable me to reorder table rows. It's working fine, here is a JSFiddle and below is my HTML and JS
<table style="width: 100%;">
<thead>
<tr>
<th>ID</th>
<th>Fruit</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Apple</td>
</tr>
<tr>
<td>2</td>
<td>Pear</td>
</tr>
<tr class="sticky">
<td>3</td>
<td>Banana</td>
</tr>
<tr>
<td>4</td>
<td>Raspberry</td>
</tr>
<tr>
<td>5</td>
<td>Mango</td>
</tr>
</tbody>
</table>
$(function(){
$("table tbody").sortable();
});
However I want to me able to drag multiple rows at the same time. Basically when you drag a tr if the tr directly below it has a class of sticky then that tr needs to be dragged with it. So in my example any time you want to drag and reorder the "Pear" row the "Banana" row underneath will be moved with it.
I think it's possible to do this with a helper function but I'm really not sure where to start. If someone could advise me on the best way to do it and point me in the right direction that would be great.
tr. Do you want the sticky item to be animated with the dragged item?