Skip to main content

Search and Top Navigation

#4825 closed bug (worksforme)

Opened September 01, 2009 05:15PM UTC

Closed November 04, 2012 06:50PM UTC

sortable doesnt handle td/th elements correctly

Reported by: markw65 Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.sortable Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

If I make a "tr" sortable, I can drag the td or th elements around, but its very hard to make them actually sort (you have to drag the element to the correct location, and then wave it up and down!)

After digging into the code for a while, I realized its because it assumes the sort is vertical, unless at least one element has "float:left" or "float:right" style. Note that this is the case even if you set "axis":"x".

I tried applying float:left to the th cells, but that caused all sorts of issues. So instead I tried:

$("#myrow").sortable().data("sortable").floating = true;

And it worked perfectly - but of course it depends on the internals of sortable.

I think it would be good if sortable recognized that if the container is a tr, the elements are going to be dragged horizontally; and also that if "axis":"x" is set, the elements are going to be dragged horizontally(!).

I have an example page at, showing the broken, and fixed behavior.

Attachments (0)
Change History (4)

Changed September 02, 2009 02:07AM UTC by scottgonzalez comment:1

milestone: TBD1.8

Changed October 08, 2009 11:10PM UTC by markw65 comment:2

Not sure if this needs a separate bug, but non-visible td/th cells aren't handled correctly in ie8.

The problem is that such cells end up with the dimensions of the row, and so _intersectsWithPointer incorrectly determines that the pointer is over the hidden cell.

This "feature" of ie8 also affects the :hidden and :visible selectors (I've filed bug 5342 against jquery). But even when that bug is fixed, _intersectsWithPointer will still need to check that style.disply != "none" (or sortable could filter out hidden items when its initialized).

I've put an example at

When IE8 runs in IE7 mode, the bug does not appear. adds the <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> to the page header, and works around the bug.

Changed October 11, 2012 02:54PM UTC by scottgonzalez comment:3


Changed November 04, 2012 06:50PM UTC by mikesherov comment:4

resolution: → worksforme
status: newclosed

Thanks for taking the time to contribute to the jQuery UI project! I can no longer reproduce the issue using the latest jQuery and jQuery UI.

If you can still reproduce it, please feel free to reply to this ticket with a test case showing the problem. Thanks!