Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Dec 07, 2007 12:13
open dhtmlx forum
Drag and drop

Hi,

I have 3 grids mygrid1, mygrid2, mygrid3. I want to

1) drag and drop items to and fro from mygrid1 to mygrid2 .

2) drag items only from mygrid1 and put it in mygrid3. not other way round

3) do not allow to drag and drop between mygrid2 and mygrid3 is it possible.

is it possible please let me know

Thanks in advance.

 

 

Answer posted by Support on Dec 10, 2007 02:08
You can attach onDrag event handler to all 3 grids and allow|deny d-n-d operation based on source and target grids


function control(sid,tid,sgrid,tgrid){
    if (sgrid==mygrid1 && tgrid==mygrid2 ) return true;
    if (sgrid==mygrid2 && tgrid==mygrid1 ) return true;
    if (sgrid==mygrid1 && tgrid==mygrid3 ) return true;
    return false;//block any other d-n-d operation
}

mygrid1.setDragHandler(control);
mygrid2.setDragHandler(control);
mygrid3.setDragHandler(control);