From d6b2a2bed3e27345e35f22834cab4fc178596ac8 Mon Sep 17 00:00:00 2001
From: Kevin Cupp
+
+
+
+
+ 1
+
11
+
+
+ 2
+ 2
+
+
+
+3
+ 3
+
diff --git a/ui/sortable.js b/ui/sortable.js
index bf1bf6a8925..4a1aa5e2396 100644
--- a/ui/sortable.js
+++ b/ui/sortable.js
@@ -785,15 +785,16 @@ return $.widget("ui.sortable", $.ui.mouse, {
_createPlaceholder: function(that) {
that = that || this;
var className,
+ nodeName,
o = that.options;
if(!o.placeholder || o.placeholder.constructor === String) {
className = o.placeholder;
+ nodeName = that.currentItem[0].nodeName.toLowerCase();
o.placeholder = {
element: function() {
- var nodeName = that.currentItem[0].nodeName.toLowerCase(),
- element = $( "<" + nodeName + ">", that.document[0] );
+ var element = $( "<" + nodeName + ">", that.document[0] );
that._addClass( element, "ui-sortable-placeholder",
className || that.currentItem[ 0 ].className )
@@ -824,9 +825,17 @@ return $.widget("ui.sortable", $.ui.mouse, {
return;
}
- //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
- if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
- if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
+ // If the element doesn't have a actual height or width by itself (without styles coming from a stylesheet),
+ // it receives the inline height and width from the dragged item. Or, if it's a tbody or tr, it's going to have
+ // a height anyway since we're populating them with
s above, but they're unlikely to be the correct height
+ // on their own if the row heights are dynamic, so we'll always assign the height of the dragged item given
+ // forcePlaceholderSize is true
+ if(!p.height() || (o.forcePlaceholderSize && (nodeName === "tbody" || nodeName === "tr"))) {
+ p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10));
+ }
+ if(!p.width()) {
+ p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10));
+ }
}
};
}