Dragging TBODY items to TABLE?

I have a table where I want to support dragging and dropping tbody elements (because I have pairs of rows that need to be moved together):

<table>
    <thead><tr>...</tr></thead>

    <tbody> <tr>...</tr> <tr>...</tr> </tbody>
    <tbody> <tr>...</tr> <tr>...</tr> </tbody>
    <tbody> <tr>...</tr> <tr>...</tr> </tbody>
</table>

I tried different things, but I'm getting closer using jQuery UI sortable:

$('table').sortable({ items: 'tbody' });

And you can really drag the lines, but:

  • When dragging a row, all elements are grouped on the left.
  • There is no indication of where the corpse will be removed. The definition of placeholder does not affect (what it does when using sorting on other elements). There seems to be no way to say that the placeholder should be TBODY.

Any suggestions on (a): how to do it using jQuery UI, or (b) another way to achieve this?

thanks neil

+3
source share

All Articles