PDA

View Full Version : Disable Drag and Drop plugin



glopes
9 Oct 2013, 2:04 PM
Hi,

I have two grid that allow drag and drop, but when the second grid reaches 5 items I would like to disable the drop action.

I have an itemadd listener added to the Grid View with the following conditional:


if(records[0].store.data.length == 5) {
// condition to disable plugin here..

} else {


}


I've tried many different ways, like:
grid.getView().getPlugin('ddPlugin').dropZone.locked = true;
grid.getView().getPlugin('ddPlugin').dropZone.lock();
grid.getView().getPlugin('ddPlugin').disable();

nothing works....

Any ideas?

Piruthu
9 Oct 2013, 10:31 PM
Try adding beforedrop (http://docs.sencha.com/extjs/4.1.1/#!/api/Ext.grid.plugin.DragDrop-event-beforedrop)listener to your grid and call 'dropFunction.cancelDrop()' to cancel the drop action

glopes
21 Oct 2013, 1:46 PM
Thanks, that worked, but is there any way to change the icon to the forbidden circle?