X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fgrid%2FGridDragZone.js;h=70932cc8b368d3919c40625b27267d7d20c982c3;hb=86b8de9b171833430cbdebcd05af0a1240f5832f;hp=e6251efdc3fd97fb5d2152e632ee8b169d7a1f43;hpb=c1424a4d4069add8d9c87eeac9dc86609743c15a;p=roojs1 diff --git a/Roo/grid/GridDragZone.js b/Roo/grid/GridDragZone.js index e6251efdc3..70932cc8b3 100644 --- a/Roo/grid/GridDragZone.js +++ b/Roo/grid/GridDragZone.js @@ -30,24 +30,54 @@ 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.. + + + //Roo.log([ sm.getSelectedCell() ? sm.getSelectedCell()[0] : 'NO' , rowIndex ]); + //if(!sm.isSelected(rowIndex) || e.hasModifier()){ - // sm.mouseDown(e, t); + // //} if (e.hasModifier()){ sm.handleMouseDown(e, t); // non modifier buttons are handled by row select. } + + Roo.log("getDragData"); + return { grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, - selections:sm.getSelections() + 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();