Dominic
Dominic

Reputation: 4952

Disable/enable drag&drop support of Vaadin 8 grid at runtime

I have a Vaadin 8 Grid with drag&drop support. Now I want to disable/reenable the drag&drop at runtime.

I tried setting the SelectionMode to None, but I am still able to drag&drop items. There also seems to be no method on the according classes to disable the drag&drop.

This is how I enabled drag&drop support:

GridDragSource<ItemA> availableItemsDragSource = new GridDragSource<>(availableItemsGrid);
GridDropTarget<ItemB> assignedItemsDropTarget = new GridDropTarget<>(assignedItemsGrid, DropMode.ON_TOP);

How can I disable drag&drop at runtime?

Upvotes: 0

Views: 339

Answers (1)

Tatu Lund
Tatu Lund

Reputation: 10623

It should be possible to disable the extension, by calling remove(), e.g. like

GridDragSource<ItemA> availableItemsDragSource = new GridDragSource<>(availableItemsGrid);
...
availableItemsDragSource.remove()

See the JavaDoc for more details.

Upvotes: 1

Related Questions