Hello,
Can I drag and drop one column from a grid to treegrid, which updates only the column of tree grid.
It should not create another child inside the tree grid but should only update the database.
Thanks.
You can use onDrag event to change the logic of d-n-d ( set new value instead of adding new row ), and use dataprocessor or any other way to save result data in DB
grid.attachEvent(“onDrag”,function(sid,tid,sgrid,tgrid){
if (sgrid != tgrid){ //draged from different grid
tgrid.cells(tid,0).setValue(sgrid.cells(sid,0).getValue());
//if dataprocessor used - mark as updated
// dp.setUpdated(tid,true);
}
return false;
})
Is there anyway I can figure out the column name or Id of the target grid where the row was dropped from the source grid.
Actually onDrag event provides 6 parameters, I just skiped two last in previous sample, so the same code can be used as
grid.attachEvent(“onDrag”,function(sid,tid,sgrid,tgrid,sindex,tindex){
…
sindex -index of column from which drag started
tindex - index of column on which drop occurs
You can convert column indexes to column names or IDs ( if they was defined ) by grid’s API