X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fgrid%2FGridDragZone.js;h=70932cc8b368d3919c40625b27267d7d20c982c3;hb=86b8de9b171833430cbdebcd05af0a1240f5832f;hp=f8173663962314c41f3b8551d1f5702359776562;hpb=dea0b6942c4df1c1b19e9f2fb30b396b0e258012;p=roojs1 diff --git a/Roo/grid/GridDragZone.js b/Roo/grid/GridDragZone.js index f817366396..70932cc8b3 100644 --- a/Roo/grid/GridDragZone.js +++ b/Roo/grid/GridDragZone.js @@ -30,14 +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); + var sm = this.grid.selModel; + + //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){ - var sm = this.grid.selModel; // if editorgrid.. - if (sm.getSelectedCell && (!sm.getSelectedCell() || (sm.getSelectedCell()[0] == rowIndex) ) ) { - return; - } + + //Roo.log([ sm.getSelectedCell() ? sm.getSelectedCell()[0] : 'NO' , rowIndex ]); + //if(!sm.isSelected(rowIndex) || e.hasModifier()){ // //} @@ -51,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();