diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-05-26 09:10:48 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-05-26 09:10:48 +0000 |
commit | 18296272adb25cee70dbbf3203cbf9e5fa788a3d (patch) | |
tree | 84a1e39aad8a310622538c9945d0d192216f27b5 /ui/source | |
parent | e7a179ef4243aa48f37fe519885eabf89a89ac25 (diff) | |
download | jquery-ui-18296272adb25cee70dbbf3203cbf9e5fa788a3d.tar.gz jquery-ui-18296272adb25cee70dbbf3203cbf9e5fa788a3d.zip |
sortable: option dropOnEmpty wasn't working correctly - in fact, you could always drop on empty containers. Now it checks again for the option, but it's default is true.
Diffstat (limited to 'ui/source')
-rw-r--r-- | ui/source/ui.sortable.js | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/ui/source/ui.sortable.js b/ui/source/ui.sortable.js index 4c5e00d35..4fddc310f 100644 --- a/ui/source/ui.sortable.js +++ b/ui/source/ui.sortable.js @@ -150,17 +150,6 @@ return false;
},
- //This method checks approximately if the item is dragged in a container, but doesn't touch any items
- inEmptyZone: function(container) {
-
- if(!$(container.options.items, container.element).length) {
- return container.options.dropOnEmpty ? true : false;
- };
-
- var last = $(container.options.items, container.element).not('.ui-sortable-helper'); last = $(last[last.length-1]);
- var top = last.offset()[this.floating ? 'left' : 'top'] + last[0][this.floating ? 'offsetWidth' : 'offsetHeight'];
- return (this.position.absolute[this.floating ? 'left' : 'top'] > top);
- },
refresh: function() {
this.refreshItems();
this.refreshPositions();
@@ -252,6 +241,9 @@ }
}
+ if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
+ continue;
+
//We also need to exchange the placeholder
if(this.placeholder) this.placeholder.remove();
if(this.containers[i].options.placeholder) {
@@ -467,7 +459,8 @@ delay: 0,
cancel: ":input,button",
items: '> *',
- zIndex: 1000
+ zIndex: 1000,
+ dropOnEmpty: true
}
});
|