Added ability to ignore list items in structure
authorAlexander Ebert <ebert@woltlab.com>
Wed, 4 Jul 2012 14:05:14 +0000 (16:05 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 4 Jul 2012 14:05:14 +0000 (16:05 +0200)
If you omit the object type id for a .sortableList-element it will not be considered as part of the structure. Useful if you're dragging elements between two lists, where one list should be ignored.

wcfsetup/install/files/js/WCF.js

index b59244a99c7d7a8f0949846942370377da8a7457..869db8a5af0f0eafec26e043e8a8d99186b8a5b5 100755 (executable)
@@ -5013,15 +5013,17 @@ WCF.Sortable.List = Class.extend({
                        var $list = $(list);
                        var $parentID = $list.data('objectID');
                        
-                       $list.children(this._options.items).each($.proxy(function(index, listItem) {
-                               var $objectID = $(listItem).data('objectID');
-                               
-                               if (!this._structure[$parentID]) {
-                                       this._structure[$parentID] = [ ];
-                               }
-                               
-                               this._structure[$parentID].push($objectID);
-                       }, this));
+                       if ($parentID !== undefined) {
+                               $list.children(this._options.items).each($.proxy(function(index, listItem) {
+                                       var $objectID = $(listItem).data('objectID');
+                                       
+                                       if (!this._structure[$parentID]) {
+                                               this._structure[$parentID] = [ ];
+                                       }
+                                       
+                                       this._structure[$parentID].push($objectID);
+                               }, this));
+                       }
                }, this));
                
                // send request