Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Satheesh Kumar K on Jul 31, 2008 11:18
open dhtmlx forum
Dropping a row into the target grid

My sourceGrid is as follows

IDV
Eddy Van Helen Gdc Onshore
Payton Manning GDC Onshore

My target Grid is as follows

S.no Project Name Resource ResourceType

1 Project x

XXX Gdc Offshore

when i dro Eddy Van Helen to project x it is adding like this

S.no Project Name Resource ResourceType

1 Project x

XXX Gdc Offshore
Eddy Van Helen GDC Offshore

it means it is not dropping under Resource and ResourceType.How can i do that.Here is the piece of code i used in jsp

function denyDrop(sourceID, targetID, sourceGrid, targetGrid, dragCol, dropCol){
var sourceProjName = sourceGrid.cells(sourceID,1).getValue();
var targetProjName = targetGrid.cells(targetID,1).getValue();

//alert('sourceProjName = ' + sourceProjName + ' | targetProjName = ' + targetProjName);

if(sourceGrid==mygrid3){        
if(sourceProjName == ""){
if(targetProjName == ""){
return false;
}
else{
//alert('true');
mygrid2.clearSelection();
return true;
}
}
else
return false;
}

if(sourceGrid==mygrid2){        
if(sourceGrid==targetGrid){
return false;
}
if(targetProjName == ""){
return false;
}
else{
mygrid2.clearSelection();
return true;
}
}
mygrid2.clearSelection();
return true;
}

Please help me on this.
Answer posted by Support on Aug 01, 2008 01:13

You can control how the row added to the grid by using  gridToGrid method
       targetGrid.gridToGrid(sid,sgrid,tgrid)=function(){
             return ["","",sgrid.cells(sid,0).getValue(),sgrid.cells(sid,1).getValue()];
       });

The method allow to define how data from source grid will be transformed while row moving.