Permalink
Browse files

Sortable: Reverted 56b0da5 as #4551 is invalid.

  • Loading branch information...
1 parent bc6a28e commit 54016b8469345a325e8c1ab6f8a7d17b0f0f8d01 @rdworth rdworth committed Apr 7, 2011
Showing with 4 additions and 54 deletions.
  1. +0 −54 tests/visual/sortable/sortable_ticket_4551.html
  2. +4 −0 ui/jquery.ui.sortable.js
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8" />
- <title>Sortable Visual Test : Sortable ticket #4551</title>
- <link rel="stylesheet" href="../visual.css" type="text/css" />
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css">
- <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.mouse.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.sortable.js"></script>
- <script type="text/javascript">
- $(function() {
- $("#first, #second").sortable({
- connectWith: '.sortable'
- }).disableSelection();
- });
- </script>
- <style type="text/css">
- .sortable { margin: 0; padding: 0; }
- .sortable div { margin: 3px 3px 3px 0; background: #ccc; padding: 1px; border: 1px solid black; float:left; width: 100px; height: 140px; font-size: 1em; text-align: center; }
- #second div { background: #acc; }
- </style>
-</head>
-<body>
-
-<h1 class="ui-widget-header"><a href="http://dev.jqueryui.com/ticket/4551">#4551 - Sortable connectWith fails if item is floated</a></h1>
-
-<div id="first" class="sortable">
- <div>1</div>
- <div>2</div>
- <div>3</div>
- <div>4</div>
- <div>5</div>
- <div>6</div>
- <div>7</div>
- <div>8</div>
- <div>9</div>
- <div>10</div>
- <div>11</div>
- <div>12</div>
-</div>
-
-<br style="clear:both;">
-<hr />
-
-<div id="second" class="sortable">
- <div>12</div>
- <div>14</div>
-</div>
-
-</body>
-</html>
View
@@ -614,6 +614,10 @@ $.widget("ui.sortable", $.ui.mouse, {
for (var i = this.items.length - 1; i >= 0; i--){
var item = this.items[i];
+ //We ignore calculating positions of all connected containers when we're not over them
+ if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
+ continue;
+
var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
if (!fast) {

1 comment on commit 54016b8

@courthead
Contributor

Hmm, why skip calculating the positions of other containers? I believe skipping this causes problems down the road when you try to drag an item into another container. None of the position information is set on that container. However, you need this info when trying to figure out where to drag the item into the container (see the loop on line 732).

In conjunction with this, there's some other quirkyness going on too that I'm investigating. But the combined effect is that when you try to drag an item from one sortable to the top of a connected sortable, it inserts it into a random position, not the top position. (Try it here: http://jqueryui.com/demos/sortable/#connect-lists)

Please sign in to comment.