Changing DragnDrop behaviour at runtime for dHtmlxTreeGrid

Hi,



In init method of dHtmlxTreeGrid I set property enableDragAndDrop(true) which moves or cuts one node and paste to another but at certain times depending on the business logic I want to copy that node means it should remain there as well get copied to new location as well and I only came to know whether I have to move or copy after i have both sourceRowID as well as targetRowID. I’m tried to use onDrag event to change the behaviour but it didn’t worked. Any help on this? Below is my code



Under Init method



EntTree.enableDragAndDrop(true);

EntTree.attachEvent(“onDrag”,moveRow);



In moveRow method



function moveRow (sourceID,targetID,srcGrid,targetGrid,startIndex,lastIndex){

var srcType = EntTree.getUserData(sourceID,“Type”);

var trgtType = EntTree.getUserData(targetID,“Type”);

var toMove = CheckMovability(srcType,trgtType)

if(toMove == true)

{

EntTree.enableDragAndDrop(‘temporary_disabled’);

EntTree.enableMercyDrag(true);

}

return toMove;

You can use mercy drag-and-drop. It that case items will be copied while drag-n-drop:
mygrid.enableMercyDrag(true);
You can find out id of a copied item using “onDrop” event:
grid.attachEvent(“onDrop”, function(sId,tId,dId,sObj,tObj,sCol,tCol){});
sId - id of the source item;
tId - id of the target item;
dId - id of the dropped item (has sense for mercy drag-n-drop);
sObj - source grid object;
tObj - target grid object;
sCol - index of the column from which drag started;
tCol - index of the column in which drop occurs.

You can find complete documentaion about drag-n-drop here dhtmlx.com/docs/products/dhtmlxG … rid_mandnd