View Full Version : Conditional drag & drop between 2 grid views

12 Dec 2011, 1:21 AM

Everything is in the title. My viewConfig is very simple:

viewConfig: {
plugins: {
ptype: 'gridviewdragdrop'

This works! But drop is always enabled. So, on the second grid, I add:
in the plugins section.

The idea would be to reactivate it after a click on a button (or any other event).
I tried:



myGrid.getPlugin( ??? ) ...

Any idea how to do that?

12 Dec 2011, 12:28 PM
myGrid.getPlugin( ??? ) ...

to use getPlugin, you have to assign an id to the plugin and then pass in the id to getPlugin.

12 Dec 2011, 1:04 PM
Yeah, I finally found that I had to add a pluginId property to my plugins. So I wrote:

// code before for the grid
plugins: {
ptype: 'gridviewdragdrop',
pluginId: 'dropuser',
ddGroup: 'groupUserDDGroup',
dragGroup: 'groupUserDDGroup',
dropGroup: 'userListDDGroup',
} // code after...

So, here the drop works (for testing).

Then, in my controller, on an event, I can disable the drop:


That works!

But I want the opposite.
I've read the code of the DragDrop plugin and it seems that once enableDrop (or Drag) is set to false, enable or disable functions won't have any effect on it.

So I had to let the enableDrop config to true and add a listener waiting for the grid to be rendered. The render event is not working, I had to use the afterrender event :

var me = this;

// In my controller
'#groupUsers': { // suppose that my grid has an itemId and that I have created a ref in my controller
afterrender: function() {