--------------------- Example of a GRID-based row-based drag-and-drop operation: drag the cursor in a single row // create the first GRIDvarfirstGridnewExt. grid. GridPanel ({ddGroup: & amp; #39; secondGridDdGroup ;#
--------------------- Example of a single row drag by GRID ---------------------------------------
// Create the first GRID
Var firstGrid = new Ext. grid. GridPanel ({
DdGroup: 'secondgridddgroup', // This is the ddGroup of the second GRID.
Store: firstGridStore,
EnableDragDrop: true, // True indicates that the drag action of the row selected in the GridPanel is enabled.
...... Other attributes are omitted
});
// Create the second GRID
Var secondGrid = new Ext. grid. GridPanel ({
DdGroup: 'firstgridddgroup', // This is the ddGroup of the first grid.
Store: secondGridStore,
EnableDragDrop: true, // True indicates that the drag action of the row selected in the GridPanel is enabled.
...... Other attributes are omitted
});
// Create the ddGroup OF THE FIRST GRID
Var firstGridDropTargetEl = firstGrid. getView (). el. dom. childNodes [0]. childNodes [1];
Var firstGridDropTarget = new Ext. dd. DropTarget (firstGridDropTargetEl ,{
DdGroup: 'firstgridddgroup', // It is the same as the ddGroup of the second GRID.
Copy: true,
Yydrop: function (ddSource, e, data ){
Function addRow (record, index, allItems ){
Var foundItem = secondGridStore. find ('name', record. data. name );
If (foundItem =-1 ){
FirstGridStore. add (record );
FirstGridStore. sort ('name', 'asc ');
DdSource. grid. store. remove (record );
}
}
Ext. each (ddSource. dragData. selections, addRow );
Return (true );
}
)};
// Create the ddGroup of the second GRID
Var secondGridDropTargetEl = secondGrid. getView (). el. dom. childNodes [0]. childNodes [1];
Var secondGridDropTarget = new Ext. dd. DropTarget (secondGridDropTargetEl ,{
DdGroup: 'secondgridddgroup', // It is the same as the ddGroup of the first grid.
Copy: true,
Yydrop: function (ddSource, e, data ){
Function addRow (record, index, allItems ){
Var foundItem = secondGridStore. find ('name', record. data. name );
If (foundItem =-1 ){
SecondGridStore. add (record );
SecondGridStore. sort ('name', 'asc ');
DdSource. grid. store. remove (record );
}
}
Ext. each (ddSource. dragData. selections, addRow );
Return (true );
}
});
----------------------------------------------------------------------