Ticket #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: | |
| Blocking: | Blocked by: |
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
Change History
comment:1 Changed 4 years ago by scott.gonzalez
- Component changed from ui.core to ui.sortable
- Milestone changed from TBD to 1.8
comment:2 Changed 4 years ago by tony@…
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 3 years ago by phloopy
-
attachment
jQuery.ui.sortable_tr_placeholder_fix.patch
added
patches _createPlaceholder to create a child td element and apply height there
comment:3 Changed 3 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 2 years ago by whittet@…
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:7 Changed 3 months ago by tj.vantoll
- Summary changed from table sortable AppleWebkit bug to Sortable: Placeholder not displayed when sorting table rows
Test case: http://jsfiddle.net/tj_vantoll/aDaVJ/. This issue occurs in all browsers.
comment:8 Changed 3 months ago by scott.gonzalez
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 3 months ago by Scott González
- Status changed from open to closed
- Resolution set to fixed
Sortable: When sorting table rows, create a td to force dimensions. Fixes #4765 - Sortable: Placeholder not displayed when sorting table rows.
Changeset: bd47bd4ace3789d9eb302b0dce6f6e042d08a7f1

