javascript - jQuery dragging (reordering) table rows between multiple tbodies -
i'm great css largely suck @ jquery. have our limitations...
ok admission out of way i'll begin. have "favourite products" table, can sectionalize categories (eg, booze, sheep, spoons). each category . each row (excluding ) product.
i want enable user drag , drop (reorder) table rows, between tbodies. i've looked @ table drag , drop (dnd) plugin jquery disappointed find doesn't support dragging between tbodies - , hasn't been updated quite time.
here basic table structure:
<table> <thead> <tr> <th>favourite</th> </tr> </thead> <tbody> <tr> <th>spoons</th> <!-- secion title, not draggable --> </tr> <tr> <td>wooden spoon</td> </tr> <tr> <td>metal spoon</td> </tr> <tr> <td>plastic spoon</td> </tr> </tbody> <tbody> <tr> <th>nuclear bombs</th> <!-- seciont title, not draggable --> </tr> <tr> <td>us nukes</td> </tr> <tr> <td>soviet nukes</td> </tr> </tbody> </table>
i'm going need turn of "dragability" of rows such first row in - being section title.
is there better version of jquery plugin out there can need? if can find better plugin please share , win "favourite person of week" award.
thank you.
your going want use jqueryui's sortable plugin , use option
connectwith: '.connectedsortable'
to connect different table bodies.
the plugin designed lists, work on tables, mostly. i've used success on table before.
here's link documentation on jquery ui's sortable:
http://jqueryui.com/demos/sortable/#connect-lists
edit:
you'll want use items option specify rows sortable
items: 'tr:not(.dontincludeme)'
Comments
Post a Comment