Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Sebastien on Mar 25, 2008 11:58
open dhtmlx forum
Drag and Drop combined with Block Selection

Hi,

I'm using a dhtmlxGrid component. I would like to enable the block selection and to be able to drop stuff on the grid also. The problem is that enabling the grid to be a drop area also enables it to be a drag source (with enableDragAndDrop(true)). The block selection is done in the same way as dragging a row (press left mouse button and start moving), but the priority seems to be given to the drag action and therefore, the block selection doesn't behave properly afterwards.

Is there a way of enabling only the grid as being a drop area and not as a drag source? Any workaround suggestion would be appreciated.

Thanks
Answer posted by Support on Mar 26, 2008 04:39
Basically the behavior contolled by next row in dhtmlxgrid.js  (line 3600)
    if (this.dragAndDropOff) this.dragger.addDraggableItem(c,this);
It can be changed to
    if (this.dragAndDropOff) this.dragger.addDragLanding(c,this);
and grid will work as drag landing only

To prevent code modification it can be done dynamically with next code

grid._dragger=grid.dragger;
grid.dragger={
    addDraggableItem:function(){
       grid._dragger.addDragLanding.apply(this,arguments);
    },
    addDragLanding:function(){
       grid._dragger.addDragLanding.apply(this,arguments);
    }
}

Answer posted by Sebastien on Mar 26, 2008 06:02

I used the code to do it dynamically when I create the grid and it works well.

Thanks