Drag and Drop an item from one grid to another specific one

Hi,



I’ve got a page with 4 simple grids on it. Now I’d like to allow item drag&drop from grid number one to number two (and reverse), and from grid number three to grid number four (and reverse).

An item from grid number one shouldn’t be dropped in grid number three or four.

An item from grid number three shouldn’t be dropped in grid number one or two.





I’ve been trying to use this method but it does not seem to work properly :



mygrid1.setDragHandler(function(sid, tid, sourceGrid, targerGrid)

{

    if(sourceGrid == mygrid2){

        return true;

    } else {

        alert(“You can’t add an item from this grid!”);

        return false;

    }

});



So I’d like to know if there is a specific function or another way so I can check the source grid and allow the item to be dropped or not?

Actually , the code which you are using is correct. But if you are using grid 1.6 you need to use different event declaration syntax.

mygrid1.attachEvent(“onDrag”,function(sid, tid, sourceGrid, targerGrid){
if(sourceGrid == mygrid2){
return true;
} else {
alert(“You can’t add an item from this grid!”);
return false;
}

})



dhtmlx.com/docs/products/dhtmlxG … rid_mandnd