Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / examples / ux / MultiSelect.js
index 08d69ef..d8e9d58 100644 (file)
@@ -1,6 +1,6 @@
 /*!
 /*!
- * Ext JS Library 3.1.0
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.1.1
+ * Copyright(c) 2006-2010 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
  */
  * licensing@extjs.com
  * http://www.extjs.com/license
  */
@@ -18,7 +18,7 @@ Ext.ns('Ext.ux.form');
  * @constructor\r
  * Create a new MultiSelect\r
  * @param {Object} config Configuration options\r
  * @constructor\r
  * Create a new MultiSelect\r
  * @param {Object} config Configuration options\r
- * @xtype multiselect \r
+ * @xtype multiselect\r
  */\r
 Ext.ux.form.MultiSelect = Ext.extend(Ext.form.Field,  {\r
     /**\r
  */\r
 Ext.ux.form.MultiSelect = Ext.extend(Ext.form.Field,  {\r
     /**\r
@@ -351,7 +351,7 @@ Ext.extend(Ext.ux.form.MultiSelect.DragZone, Ext.dd.DragZone, {
         this.onStartDrag(x, y);\r
         return true;\r
     },\r
         this.onStartDrag(x, y);\r
         return true;\r
     },\r
-    \r
+\r
     // private\r
     collectSelection: function(data) {\r
         data.repairXY = Ext.fly(this.view.getSelectedNodes()[0]).getXY();\r
     // private\r
     collectSelection: function(data) {\r
         data.repairXY = Ext.fly(this.view.getSelectedNodes()[0]).getXY();\r
@@ -440,9 +440,9 @@ Ext.ux.form.MultiSelect.DropZone = function(ms, config){
 \r
 Ext.extend(Ext.ux.form.MultiSelect.DropZone, Ext.dd.DropZone, {\r
     /**\r
 \r
 Ext.extend(Ext.ux.form.MultiSelect.DropZone, Ext.dd.DropZone, {\r
     /**\r
-        * Part of the Ext.dd.DropZone interface. If no target node is found, the\r
-        * whole Element becomes the target, and this causes the drop gesture to append.\r
-        */\r
+     * Part of the Ext.dd.DropZone interface. If no target node is found, the\r
+     * whole Element becomes the target, and this causes the drop gesture to append.\r
+     */\r
     getTargetFromEvent : function(e) {\r
         var target = e.getTarget();\r
         return target;\r
     getTargetFromEvent : function(e) {\r
         var target = e.getTarget();\r
         return target;\r
@@ -525,9 +525,14 @@ Ext.extend(Ext.ux.form.MultiSelect.DropZone, Ext.dd.DropZone, {
         var pt = this.getDropPoint(e, n, dd);\r
         if (n != this.ms.fs.body.dom)\r
             n = this.view.findItemFromChild(n);\r
         var pt = this.getDropPoint(e, n, dd);\r
         if (n != this.ms.fs.body.dom)\r
             n = this.view.findItemFromChild(n);\r
-        var insertAt = (this.ms.appendOnly || (n == this.ms.fs.body.dom)) ? this.view.store.getCount() : this.view.indexOf(n);\r
-        if (pt == "below") {\r
-            insertAt++;\r
+\r
+        if(this.ms.appendOnly) {\r
+            insertAt = this.view.store.getCount();\r
+        } else {\r
+            insertAt = n == this.ms.fs.body.dom ? this.view.store.getCount() - 1 : this.view.indexOf(n);\r
+            if (pt == "below") {\r
+                insertAt++;\r
+            }\r
         }\r
 \r
         var dir = false;\r
         }\r
 \r
         var dir = false;\r