PDA

View Full Version : GridRow as a DropTarget



kanister
15 Mar 2011, 4:20 AM
Hi,
Im trying to get it work but i fail. I need to drop row from one grid onto another's grid row (i must have info on row dropped on).. Yet i found solution to do so, there are only tuts for haveing whole grid view as a droptarget witch is not what i need.

Pleas help me make it work. Any solution?

p.s. i managed to succeed with some DOM travestation but its not what i had in mind....

...on store load i create for each row a target:

for (i=0;i<rows.length;i++){
new Ext.dd.DropTarget(rows[i], {
ddGroup:'DDG_action_project',
...

....then i notifyDrop like :

notifyDrop : function(dd, e, gridData){
var row = Ext.get(this.el.id).dom;
var nodes = row.childNodes[0].childNodes[0].childNodes[0].childNodes;
for(j=0;j<nodes.length;j++){
if(nodes[j].childNodes[0].className == 'x-grid3-cell-inner x-grid3-col-1'){
alert(nodes[j].childNodes[0].innerHTML);// SIC!
}
}

....and all of this just to get row being dropped on value in column 1;

... please save me from this misery!

TopKatz
13 Jan 2014, 10:34 AM
I know this is old, but I had need for it and never found a solution on the forum. I did find it on some blog though:

http://www.fusioncube.net/index.php/extjs-drag-drop-target-detection

Basically adding


targetRow = TargetGrid.getView().findRowIndex(e.target);
targetDataItem = TargetGrid.store.data.items[targetRow];

will get you the data of the row being dropped on.