I have an HTML table (#view-page-table) with close to the following HTML:
<table id="view-page-table">
<thead>
<th>Header1</th>
<th>Header2</th>
</thead>
<tbody>
<tr><td>Group 1</td><td>Group 1</td></tr>
<tr><td>Group 1</td><td>Group 1</td></tr>
<tr><td>Group 2</td><td>Group 2</td></tr>
<tr><td>Group 2</td><td>Group 2</td></tr>
<tr><td>Group 3</td><td>Group 3</td></tr>
<tr><td>Group 3</td><td>Group 4</td></tr>
</tbody>
</table>
My jQuery is simple right now:
function reOrder() {
$("#view-page-table tbody").sortable({
helper: function(e, ui) {
ui.children().each(function() {
$(this).width($(this).width());
});
return ui;
}
}).disableSelection();
}
It seems to work fine (the helper function is to maintain cell width while moving). The only problem is, I need to move two <tr>'s at a time. In other words, the user needs to drag all of group one, two, or three without being able to drag just one row. I tried to add a div in the table but I guess that's a no-no.