r1098 - trunk/ui

r1098 - trunk/ui


Author: paul.bakaus
Date: Thu Dec 11 07:02:21 2008
New Revision: 1098
Modified:
trunk/ui/ui.draggable.js
Log:
sortable: fixed connectToSortable option, wasn't working with Arrays as
described in the documentation
Modified: trunk/ui/ui.draggable.js
==============================================================================
--- trunk/ui/ui.draggable.js    (original)
+++ trunk/ui/ui.draggable.js    Thu Dec 11 07:02:21 2008
@@ -395,15 +395,19 @@
        var inst = $(this).data("draggable");
        inst.sortables = [];
        $(ui.options.connectToSortable).each(function() {
-            if($.data(this, 'sortable')) {
-                var sortable = $.data(this, 'sortable');
-                inst.sortables.push({
-                    instance: sortable,
-                    shouldRevert: sortable.options.revert
-                });
-                sortable._refreshItems();    //Do a one-time refresh at start to refresh
the containerCache
-                sortable._propagate("activate", event, inst);
-            }
+            // 'this' points to a string, and should therefore resolved as query,
but instead, if the string is assigned to a variable, it loops through the
strings properties,
+            // so we have to append '' to make it anonymous again
+            $(this+'').each(function() {
+                if($.data(this, 'sortable')) {
+                    var sortable = $.data(this, 'sortable');
+                    inst.sortables.push({
+                        instance: sortable,
+                        shouldRevert: sortable.options.revert
+                    });
+                    sortable._refreshItems();    //Do a one-time refresh at start to refresh
the containerCache
+                    sortable._propagate("activate", event, inst);
+                }
+            });
        });
    },