diff options
author | Scott González <scott.gonzalez@gmail.com> | 2013-02-20 20:16:29 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2013-02-20 20:16:29 -0500 |
commit | bd47bd4ace3789d9eb302b0dce6f6e042d08a7f1 (patch) | |
tree | 5fe5f89b509a5b58c9fa3b4d07401cebf2902b48 /ui | |
parent | 51eb28e76e372fe0af12724edff0b5780b5e5ed0 (diff) | |
download | jquery-ui-bd47bd4ace3789d9eb302b0dce6f6e042d08a7f1.tar.gz jquery-ui-bd47bd4ace3789d9eb302b0dce6f6e042d08a7f1.zip |
Sortable: When sorting table rows, create a td to force dimensions. Fixes #4765 - Sortable: Placeholder not displayed when sorting table rows.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.sortable.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index c9b503bd0..f095ce9c5 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -752,15 +752,23 @@ $.widget("ui.sortable", $.ui.mouse, { o.placeholder = { element: function() { - var el = $(document.createElement(that.currentItem[0].nodeName)) - .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") - .removeClass("ui-sortable-helper")[0]; + var nodeName = that.currentItem[0].nodeName.toLowerCase(), + element = $( that.document[0].createElement( nodeName ) ) + .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") + .removeClass("ui-sortable-helper"); + + if ( nodeName === "tr" ) { + // Use a high colspan to force the td to expand the full + // width of the table (browsers are smart enough to + // handle this properly) + element.append( "<td colspan='99'> </td>" ); + } - if(!className) { - el.style.visibility = "hidden"; + if ( !className ) { + element.css( "visibility", "hidden" ); } - return el; + return element; }, update: function(container, p) { |