aboutsummaryrefslogtreecommitdiffstats
path: root/ui/sortable.js
diff options
context:
space:
mode:
authorTJ VanToll <tj.vantoll@gmail.com>2014-10-31 09:46:41 -0400
committerTJ VanToll <tj.vantoll@gmail.com>2014-11-04 08:15:26 -0500
commitf656aebe3f99356b7eb91ffdafe6689ecc8fb4ae (patch)
treee8999481ef698721b4146f651583721a7b5d2cde /ui/sortable.js
parentfb4124b7af4e87712eca9893f7aefb5fee7905de (diff)
downloadjquery-ui-f656aebe3f99356b7eb91ffdafe6689ecc8fb4ae.tar.gz
jquery-ui-f656aebe3f99356b7eb91ffdafe6689ecc8fb4ae.zip
Sortable: Redetermine floating flag when recalculating positions
This addresses a bug where users initialize empty sortable lists are add items dynamically. In this situation refresh() should recognize the position and orientation of the new items. Fixes #7498 Closes gh-1381
Diffstat (limited to 'ui/sortable.js')
-rw-r--r--ui/sortable.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/ui/sortable.js b/ui/sortable.js
index 0207c8620..913949c20 100644
--- a/ui/sortable.js
+++ b/ui/sortable.js
@@ -77,17 +77,12 @@ return $.widget("ui.sortable", $.ui.mouse, {
},
_create: function() {
-
- var o = this.options;
this.containerCache = {};
this.element.addClass("ui-sortable");
//Get the items
this.refresh();
- //Let's determine if the items are being displayed horizontally
- this.floating = this.items.length ? o.axis === "x" || this._isFloating(this.items[0].item) : false;
-
//Let's determine the parent's offset
this.offset = this.element.offset();
@@ -731,6 +726,11 @@ return $.widget("ui.sortable", $.ui.mouse, {
refreshPositions: function(fast) {
+ // Determine whether items are being displayed horizontally
+ this.floating = this.items.length ?
+ this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
+ false;
+
//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
if(this.offsetParent && this.helper) {
this.offset.parent = this._getParentOffset();