aboutsummaryrefslogtreecommitdiffstats
path: root/ui/sortable.js
diff options
context:
space:
mode:
authorNils Heuermann <nils@world-of-scripts.de>2014-10-31 14:24:29 +0100
committerScott González <scott.gonzalez@gmail.com>2015-02-24 09:36:12 -0500
commit962e05dc1d0a51a7458bc44725417aa3462cd89a (patch)
tree01a5bc392ee4b4c5bb73f606304b516b8c104665 /ui/sortable.js
parentd95c23ae6c44e7d82289bb0a82eb1a7840a7a5f2 (diff)
downloadjquery-ui-962e05dc1d0a51a7458bc44725417aa3462cd89a.tar.gz
jquery-ui-962e05dc1d0a51a7458bc44725417aa3462cd89a.zip
Sortable: Append a tr with td to the placeholder of tbody elements
When sorting tbody elements of a table the placeholder needs to have a tr with td elements to be visible. The appended elements are created in the same way as for the placeholder of a tr element; the first row of the sorted tbody is used for that. Fixes #10682 Closes gh-1380
Diffstat (limited to 'ui/sortable.js')
-rw-r--r--ui/sortable.js23
1 files changed, 17 insertions, 6 deletions
diff --git a/ui/sortable.js b/ui/sortable.js
index b31c285e0..6273109c6 100644
--- a/ui/sortable.js
+++ b/ui/sortable.js
@@ -793,12 +793,13 @@ return $.widget("ui.sortable", $.ui.mouse, {
.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
.removeClass("ui-sortable-helper");
- if ( nodeName === "tr" ) {
- that.currentItem.children().each(function() {
- $( "<td>&#160;</td>", that.document[0] )
- .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
- .appendTo( element );
- });
+ if ( nodeName === "tbody" ) {
+ that._createTrPlaceholder(
+ that.currentItem.find( "tr" ).eq( 0 ),
+ $( "<tr>", that.document[ 0 ] ).appendTo( element )
+ );
+ } else if ( nodeName === "tr" ) {
+ that._createTrPlaceholder( that.currentItem, element );
} else if ( nodeName === "img" ) {
element.attr( "src", that.currentItem.attr( "src" ) );
}
@@ -835,6 +836,16 @@ return $.widget("ui.sortable", $.ui.mouse, {
},
+ _createTrPlaceholder: function( sourceTr, targetTr ) {
+ var that = this;
+
+ sourceTr.children().each(function() {
+ $( "<td>&#160;</td>", that.document[ 0 ] )
+ .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
+ .appendTo( targetTr );
+ });
+ },
+
_contactContainers: function(event) {
var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
innermostContainer = null,