There is a disable and enable that locks and unlocks the dragzone and dropzone on the plugin.
Using the grid to grid drag and drop example from the downloaded examples, I have edited the displayPanel and added a couple buttons to the bottom docked toolbar to enable/disable the drag/drop on the 2nd grid and works like a charm. When I press the disable button, it will not allow any dragging from or dropping to the right grid. If I press the enable button, it will then allow both dragging and dropping on the second grid. Edits to the example are in red (the entire example is not here):
Code:
// create the destination Grid
var secondGrid = Ext.create('Ext.grid.Panel', {
viewConfig: {
plugins: {
ptype: 'gridviewdragdrop',
pluginId: 'gridviewdragdrop',
dragGroup: 'secondGridDDGroup',
dropGroup: 'firstGridDDGroup'
},
listeners: {
drop: function(node, data, dropRec, dropPosition) {
var dropOn = dropRec ? ' ' + dropPosition + ' ' + dropRec.get('name') : ' on empty view';
Ext.example.msg("Drag from left to right", 'Dropped ' + data.records[0].get('name') + dropOn);
}
}
},
store : secondGridStore,
columns : columns,
stripeRows : true,
title : 'Second Grid',
margins : '0 0 0 3'
});
//Simple 'border layout' panel to house both grids
var displayPanel = Ext.create('Ext.Panel', {
width : 650,
height : 300,
layout : {
type: 'hbox',
align: 'stretch',
padding: 5
},
renderTo : 'panel',
defaults : { flex : 1 }, //auto stretch
items : [
firstGrid,
secondGrid
],
dockedItems: {
xtype: 'toolbar',
dock: 'bottom',
items: ['->', // Fill
{
text : 'Disable',
handler : function() {
var view = secondGrid.getView(),
plugin = view.getPlugin('gridviewdragdrop');
plugin.disable();
}
},
{
text : 'Enable',
handler : function() {
var view = secondGrid.getView(),
plugin = view.getPlugin('gridviewdragdrop');
plugin.enable();
}
},
{
text: 'Reset both grids',
handler: function(){
//refresh source grid
firstGridStore.loadData(myData);
//purge destination grid
secondGridStore.removeAll();
}
}]
}
});