Opened 14 years ago

Closed 10 years ago

Last modified 10 years ago

#4765 closed bug (fixed)

Sortable: Placeholder not displayed when sorting table rows

Reported by: soulhunter Owned by:
Priority: major Milestone: 1.10.2
Component: ui.sortable Version: 1.7.2
Keywords: sortable table tr safari chrome Cc:
Blocked by: Blocking:

Description

When applying sortable() to a table ($('tbody').sortable()) and trying to sort rows in Google Chrome or Safari (based on the same rendering engine) - the placeholder is not shown, so the affect of row replacing doesn't occure. This happens because the empry <tr/>'s are not displayed. As i think table rows sorting is a frequent task so it would ge good to fix it. I just canged the code in _createPlaceholder() so that if sorting item is tr - it appends an empty <td/> to it and set's the size (width and height, most often it is only height) of this <td/> instead of <tr/>. This method works in Chrome, Safari, Firefox and Opera. IE wasn't tested.

Attachments (1)

jQuery.ui.sortable_tr_placeholder_fix.patch (2.3 KB) - added by phloopy 13 years ago.
patches _createPlaceholder to create a child td element and apply height there

Download all attachments as: .zip

Change History (11)

comment:1 Changed 14 years ago by Scott González

Component: ui.coreui.sortable
Milestone: TBD1.8

comment:2 Changed 14 years ago by [email protected]

Hello, I can confirm this bug. Moreover I see the following behavior in Chrome (Same in Safari). When we have a table-layout set to fixed for the table, after sorting a table row, the row have all the attributes of the helper - i.e the position:absolute and etc. - whit other words resting does not apply correct.

Changed 13 years ago by phloopy

patches _createPlaceholder to create a child td element and apply height there

comment:3 Changed 13 years ago by phloopy

I attached a patch file that fixes this issue (tested in Chrome 3.0.195.33, Firefox 3.5.6, Safari 4.0.4 (531.21.10), and IE 8.0.7600.16385). I'm not able to understand the problem Tony describes, so that has not been addressed.

comment:4 Changed 12 years ago by [email protected]

This is still a bug in version 1.8.12.

Demo problem: http://jsfiddle.net/whittet/P2yuG/

Use case: A) drag the "1" to the right column and drop it B) "1" should display above either cell in the second row! Definitely not outside the table.

Note a patch is attached. Does anyone have time to review the change? Why hasn't this been done already? The code is here, does it need to be in a pull request?

comment:5 Changed 11 years ago by Scott González

Milestone: 1.9.02.0.0

comment:6 Changed 11 years ago by petersendidit

Status: newopen

comment:7 Changed 10 years ago by tj.vantoll

Summary: table sortable AppleWebkit bugSortable: Placeholder not displayed when sorting table rows

Test case: http://jsfiddle.net/tj_vantoll/aDaVJ/. This issue occurs in all browsers.

comment:8 Changed 10 years ago by Scott González

The proposed fix is much larger than something I'd like to see in the plugin. The problem comes from the fact that empty table rows don't have any content to show. Here's a workaround using the ghetto, undocumented, placeholder API: http://jsfiddle.net/aDaVJ/3/

comment:9 Changed 10 years ago by Scott González

Resolution: fixed
Status: openclosed

Sortable: When sorting table rows, create a td to force dimensions. Fixes #4765 - Sortable: Placeholder not displayed when sorting table rows.

Changeset: bd47bd4ace3789d9eb302b0dce6f6e042d08a7f1

comment:10 Changed 10 years ago by Scott González

Milestone: 2.0.01.10.2
Note: See TracTickets for help on using tickets.