Changed Roo/grid/GridDragZone.jsroojs-all.jsroojs-debug.jsroojs-ui-debug.jsroojs...
[roojs1] / Roo / grid / GridDragZone.js
index 90f669d..c62baab 100644 (file)
@@ -30,15 +30,29 @@ Roo.extend(Roo.grid.GridDragZone, Roo.dd.DragZone, {
     getDragData : function(e){
         var t = Roo.lib.Event.getTarget(e);
         var rowIndex = this.view.findRowIndex(t);
-        Roo.log(rowIndex);
-        if(rowIndex !== false){
-            var sm = this.grid.selModel;
+        var sm = this.grid.selModel;
             
-            // if editorgrid.. 
-            if (sm.getSelectedCell && (!sm.getSelectedCell() || (sm.getSelectedCell()[0] == rowIndex) ) ) {
-                Roo.log([ sm.getSelectedCell() ? sm.getSelectedCell()[0] : 'NO' , rowIndex ]);
+        //Roo.log(rowIndex);
+        
+        if (sm.getSelectedCell) {
+            // cell selection..
+            if (!sm.getSelectedCell()) {
+                return false;
+            }
+            if (rowIndex != sm.getSelectedCell()[0]) {
                 return false;
             }
+        
+        }
+        
+        var sels = sm.getSelections ? sm.getSelections() : (
+                    sm.getSelectedCell() ? [ this.grid.ds.getAt(sm.getSelectedCell()[0]) ] : []);
+        
+        // before it used to all dragging of unseleted... - now we dont do that.
+        if(sels){
+            
+            // if editorgrid.. 
+            
             
             //Roo.log([ sm.getSelectedCell() ? sm.getSelectedCell()[0] : 'NO' , rowIndex ]);
                
@@ -56,13 +70,18 @@ Roo.extend(Roo.grid.GridDragZone, Roo.dd.DragZone, {
                 ddel: this.ddel,
                 rowIndex: rowIndex,
                 selections:sm.getSelections ? sm.getSelections() : (
-                    sm.getSelectedCell() ? [ grid.ds.getAt(sm.getSelectedCell()[0]) ] : []
+                    sm.getSelectedCell() ? [ this.grid.ds.getAt(sm.getSelectedCell()[0]) ] : []
                 )
             };
         }
         return false;
     },
-
+    
+    onBeforeDrag : function(data, e)
+    {
+        // if we dont have any data to drag - then cancel.
+        return data !== false;
+    },
     onInitDrag : function(e){
         var data = this.dragData;
         this.ddel.innerHTML = this.grid.getDragDropText();