Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dennis on Oct 15, 2008 05:49
open dhtmlx forum
Cancel GridToGrid

Dear Sir/Madam,

I got 3 grids on one page. I want 2 grids to be able to drag and drop between both of them.

The other grid should be able to drag and drop within its own grid, but not drop in the other two grids nor accept drops from other grids.

I tried to alter the gridToGrid method but there is no way to cancel a drop with that method (return false/null/true won't cancel).

What can I do to let one grid ignore the drops of others.

Thanks in advance
Answer posted by Support on Oct 15, 2008 08:53
>>What can I do to let one grid ignore the drops of others.

Please check
http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Managed_Drag_and_Drop.html#grid_mandnd

In your case , the best solution is to use onDrag event of 3rd grid

grid3.attachEvent("onDrag",function(sid,tid,sobj,tobj){
    if (sobj == tobj) return true; //allow drag from the same grid
    return false; //block drag from any  other grid
});

The similar code need to be added to grid1 and grid2 

grid1.attachEvent("onDrag",function(sid,tid,sobj,tobj){
    if (sobj == grid3) return false; //block drag from 3rd grid
    return true; //allow drag from any other grid
});