1

I'm trying to use jQuery UI Sortable component to arrange rows within a table. (Code and markup posted at http://jsfiddle.net/LpyXh/.)

But I want to be able to drag groups of rows. In my example, whenever I drag a row, I also want to drag all the rows that have the current row as the parent (data-parent attribute). The result is that children will always be with their parent. Note that the rows I want to drag will always be grouped together.

But it's not looking like Sortable supports this. Any suggestions?

Jonathan Wood
  • 65,341
  • 71
  • 269
  • 466

1 Answers1

1

What about breaking up your parent/child groups into their own tables. Then you can just drag the tables. Wouldn't that be cleaner?

CoderMarkus
  • 1,118
  • 1
  • 10
  • 24
  • Yes, I'm sure it would. But this is a huge application and I'm really tasks to work with the markup that is already in place. The other option is to just drag one item, and then write code to move the child items when it's dropped. But it would be much nicer if I could make this part of the drag operation. – Jonathan Wood Aug 21 '12 at 21:45
  • Just found this... not sure if it will work exactly as you want (as you have to click on each item), but it might get you part of theway there... http://stackoverflow.com/questions/3774755/jquery-sortable-select-and-drag-multiple-list-items – CoderMarkus Aug 21 '12 at 21:52
  • Interesting. However, it seems a bit buggy. For one thing, the feature where the sortable components shifts things around while you drag doesn't work when I select multiple items. Also, if I drag 1 and 2 down to the bottom, there's no way to move them back where they started. I'll continue testing... – Jonathan Wood Aug 21 '12 at 21:57