Issue demonstrated: http://jsfiddle.net/VLvj9/1/
With the html
<table>
<tbody class="sortme">
<tr><td>Foo</td></tr>
<tr><td>Bar</td></tr>
<tr><td>Really long and annoying table row, try to sort me!</td></tr>
</tbody>
</table>
and the jqueryui
$(".sortme").sortable({
containment: "parent",
tolerance: "pointer"
}).disableSelection();
If you attempt to drag and sort either long row, the parent container snaps its width down. The helper is shoved left off the screen by the new tiny parent, and is unable to be sorted.
This doesn't occur without the containment
attribute. I can modify the placeholder's width in the start()
event to keep the parent wide, but it appears the containment information has already been set by that point and the helper exhibits the same behavior.
Is there any way to have the parent maintain its width information so that containment will work as expected?
I believe this question is referring to the same behavior:
jQueryUI sortable on table rows shrinks them while being dragged
My issue is that table contents are populated by ajax calls (status checking of user <input> content) and the width can change arbitrarily during the page's lifetime, so I can't set a px width on the td or the table.