PDA

View Full Version : Drag-n-drop from Grid panel to another Grid-Panel and another panel



sarabjeetd
4 Apr 2012, 2:47 AM
I am using Ext JS 4.1.0 Beta 2a
I am implementing drag-n-drop from a Grid Table to a panel. There is already a Grid-Grid drag-n-drop configured on the grid table. When I comment out the dragGroup and dropGroup property and add a new ddGroup property, the Grid-Panel drag-drop works but the Grid-Grid drag-drop does not work.

What changes I should make such that I can drag a row to another Grid and also drag a row to a panel.

Here is the source Grid panel config:


viewConfig:{
copy:true,
plugins:{
ptype:'gridviewdragdrop',
dragGroup:'tableColumnGridDDGroup',
dropGroup:'disabledGridDDGroup',
enableDrop:false,

}
},


Here is the destination Grid config:



viewConfig: {

plugins: {
ptype: 'gridviewdragdrop',
dragGroup: 'disabledGridDDGroup',
dropGroup: 'tableColumnGridDDGroup',
enableDrag: false
}
},



Here is the code for the drag on the panel:



// chartPanel is the panel on which the row is dropped.

var formPanelDropTargetEl = chartPanel.body.dom;

var formPanelDropTarget = Ext.create('Ext.dd.DropTarget', formPanelDropTargetEl, {
ddGroup: 'disabledGridDDGroup',
notifyEnter: function(ddSource, e, data) {

//Add some flare to invite drop.
//formPanel.body.stopAnimation();
chartPanel.body.highlight();
DiagApp.logger.debug("ProbeSummaryTableController:notifyEnter() ");
},
notifyDrop : function(ddSource, e, data){

// Reference the record (single selection) for readability
var selectedRecord = ddSource.dragData.records;
DiagApp.logger.debug("ProbeSummaryTableController:notifyDrop() data=" + selectedRecord);
// Load the chart with the additional metric



return true;
}
});

scottmartin
4 Apr 2012, 5:43 AM
Have your reviewed these examples:
http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/dd/dnd_grid_to_grid.html
http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/dd/dnd_grid_to_formpanel.html

Also, if you are using 4.1, please upgrade to RC2 as there have been _many_ updates since B2
http://www.sencha.com/blog/ext-js-4-1-rc-2-released/

Regards,
Scott.