diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2014-08-25 08:21:15 -0400 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2014-08-25 18:23:11 -0400 |
commit | a611dd8971a5fada1ca9e661ad1944b401192f0d (patch) | |
tree | 285ab17d6c6a6b8c8d9d113f2814858268123046 /ui | |
parent | 368fc8395b60b0f1fcfd0ceebe697709052ab44d (diff) | |
download | jquery-ui-a611dd8971a5fada1ca9e661ad1944b401192f0d.tar.gz jquery-ui-a611dd8971a5fada1ca9e661ad1944b401192f0d.zip |
Draggable: Refresh sortables when draggable is added or removed
Since a sortable grows or shrinks when a draggable element is added
to it, refresh the cached positions of sortables whenever an element
is added or removed from the sortable.
Refs #9675
Diffstat (limited to 'ui')
-rw-r--r-- | ui/draggable.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/draggable.js b/ui/draggable.js index 7ad5d0c37..4e81ac3eb 100644 --- a/ui/draggable.js +++ b/ui/draggable.js @@ -834,6 +834,12 @@ $.ui.plugin.add("draggable", "connectToSortable", { // used solely in the revert option to handle "valid/invalid". draggable.dropped = sortable.element; + // Need to refreshPositions of all sortables in the case that + // adding to one sortable changes the location of the other sortables (#9675) + $.each( draggable.sortables, function() { + this.refreshPositions(); + }); + // hack so receive/update callbacks work (mostly) draggable.currentItem = draggable.element; sortable.fromOutside = draggable; @@ -882,6 +888,12 @@ $.ui.plugin.add("draggable", "connectToSortable", { // Inform draggable that the helper is no longer in a valid drop zone draggable.dropped = false; + + // Need to refreshPositions of all sortables just in case removing + // from one sortable changes the location of other sortables (#9675) + $.each( draggable.sortables, function() { + this.refreshPositions(); + }); } } }); |