Ticket #4765 (closed bug: fixed)

Opened 5 years ago

Last modified 14 months ago

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

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

Change History

comment:1 Changed 5 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 4 years ago by phloopy

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

comment:3 Changed 4 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 3 years ago by whittet@…

This is still a but in 1.8.12 per my test case using Google Chrome:

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

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

Version 0, edited 3 years ago by whittet@… (next)

comment:5 Changed 19 months ago by scott.gonzalez

  • Milestone changed from 1.9.0 to 2.0.0

comment:6 Changed 18 months ago by petersendidit

  • Status changed from new to open

comment:7 Changed 14 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 14 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 14 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

comment:10 Changed 14 months ago by scott.gonzalez

  • Milestone changed from 2.0.0 to 1.10.2
Note: See TracTickets for help on using tickets.