Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by sandro on Mar 12, 2008 14:33
open dhtmlx forum
mercy drag

Hi,

I have several grids on a page. I notice that when i drag a row from one grid and drop it on another, the item disappears from the first grid and is inserted into the new grid. Since I only want a copy of the item, I enabled mercydrag, which keeps a copy in the original grid. this allows item to exist in both grids.

However, now dragging rows INSIDE a grid (resorting, moving up and down, etc) results in copies, duplicates, being made within the grid itself. Within a grid i want the original behaviour of moving, not copying, the row.

How do I do that?

thanks!
Answer posted by Support on Mar 13, 2008 01:40
Can be done in next way

//mercy drag NOT enabled
grid.attachEvent("onDrag",function(sid,tid,sgrid,tgrid){
    if (sgrid==tgrid) return true; // do nothing for d-n-d inside the same grid
    else {   //for d-n-d between different objects
       this.dragContext.set("mode","copy");   //this will switch current operation to "copy" mode.
       return true;
    }
});