Fixed a few issues with WCF.Sortable.List
authorAlexander Ebert <ebert@woltlab.com>
Wed, 4 Jul 2012 16:20:07 +0000 (18:20 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 4 Jul 2012 16:20:07 +0000 (18:20 +0200)
wcfsetup/install/files/js/WCF.js

index 869db8a5af0f0eafec26e043e8a8d99186b8a5b5..11988388533eb802c794deaf05eb8278f342be0a 100755 (executable)
@@ -4912,6 +4912,12 @@ WCF.Sortable = {};
  * @param      object          options
  */
 WCF.Sortable.List = Class.extend({
+       /**
+        * additional parameters for AJAX request
+        * @var object
+        */
+       _additionalParameters: { },
+       
        /**
         * action class name
         * @var string
@@ -4968,8 +4974,10 @@ WCF.Sortable.List = Class.extend({
         * @param       integer         offset
         * @param       object          options
         * @param       boolean         isSimpleSorting
+        * @param       object          additionalParameters
         */
-       init: function(containerID, className, offset, options, isSimpleSorting) {
+       init: function(containerID, className, offset, options, isSimpleSorting, additionalParameters) {
+               this._additionalParameters = additionalParameters || { };
                this._containerID = $.wcfEscapeID(containerID);
                this._container = $('#' + this._containerID);
                this._className = className;
@@ -5008,6 +5016,9 @@ WCF.Sortable.List = Class.extend({
         * Saves object structure.
         */
        _submit: function() {
+               // reset structure
+               this._structure = { };
+               
                // build structure
                this._container.find('.sortableList').each($.proxy(function(index, list) {
                        var $list = $(list);
@@ -5027,15 +5038,17 @@ WCF.Sortable.List = Class.extend({
                }, this));
                
                // send request
-               this._proxy.setOption('data', {
-                       actionName: 'updatePosition',
-                       className: this._className,
-                       parameters: {
+               var $parameters = $.extend(true, {
                                data: {
                                        offset: this._offset,
                                        structure: this._structure
                                }
-                       }
+               }, this._additionalParameters);
+               
+               this._proxy.setOption('data', {
+                       actionName: 'updatePosition',
+                       className: this._className,
+                       parameters: $parameters
                });
                this._proxy.sendRequest();
        },