Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Dec 14, 2007 08:55
open dhtmlx forum
drag and drop

Hi,

I need small validation check.

I have 3 grids mygrid1, mygrid2, mygrid3. Between mygrid1 and mygrid3 I am allowing mercy drag but between mygrid1 and mygrid2 mercy drag is disabled.

1) I want a message to popup if the same field is drag and drop twice from mygrid1 to mygrid3

2) I want a message to popup if initially field is drag and droped from mygrid1 to mygrid3 and then tha same field is moved to mygrid2. (here mygrid1 is my source grid and mygrid2 is removed grid)

I will really appreciate your help in this.

Thanks in advance.

Answer posted by Support on Dec 14, 2007 10:13
In "mercy" drag and drop mode , ID of row after moving changed, so you can't track the origin of elements so easily.
The next may help

function controller(sid,tid,sgrid,tgrid){
    //check if already moved
    if ((sgrid.getUserData(sid,"moved") || tgrid.getUserData(tid,"moved")){
       alert("already moved");
       return false;
    }
   
    //mark row as moved
    sgrid.setUserData(sid,"moved",true)
    tgrid.setUserData(tid,"moved",true)
    return true;
 
}


mygrid1.setDragHandler(controller);
mygrid3.setDragHandler(controller);