X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fgrid%2FGridDragZone.js;h=70932cc8b368d3919c40625b27267d7d20c982c3;hb=86b8de9b171833430cbdebcd05af0a1240f5832f;hp=a7ca43d8f29c9280d9deed8238744bddac2306af;hpb=2ac77e5909c16f1759313073617f0b6b707dc5fa;p=roojs1 diff --git a/Roo/grid/GridDragZone.js b/Roo/grid/GridDragZone.js index a7ca43d8f2..70932cc8b3 100644 --- a/Roo/grid/GridDragZone.js +++ b/Roo/grid/GridDragZone.js @@ -30,15 +30,33 @@ Roo.extend(Roo.grid.GridDragZone, Roo.dd.DragZone, { getDragData : function(e){ var t = Roo.lib.Event.getTarget(e); var rowIndex = this.view.findRowIndex(t); - 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; } + + } + if (sm.getSelections && sm.getSelections().length < 1) { + return false; + } + + + // before it used to all dragging of unseleted... - now we dont do that. + if(rowIndex !== false){ + + // if editorgrid.. + + //Roo.log([ sm.getSelectedCell() ? sm.getSelectedCell()[0] : 'NO' , rowIndex ]); + //if(!sm.isSelected(rowIndex) || e.hasModifier()){ // //} @@ -52,14 +70,14 @@ Roo.extend(Roo.grid.GridDragZone, Roo.dd.DragZone, { grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, - selections:sm.getSelections ? sm.getSelections() : ( - sm.getSelectedCell() ? [ grid.ds.getAt(sm.getSelectedCell()[0]) ] : [] - ) + selections: sm.getSelections ? sm.getSelections() : ( + sm.getSelectedCell() ? [ this.grid.ds.getAt(sm.getSelectedCell()[0]) ] : []) }; } return false; }, - + + onInitDrag : function(e){ var data = this.dragData; this.ddel.innerHTML = this.grid.getDragDropText();