Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Drag & drop group of components
we have successfully used drag&drop in our application. (Works fine and simple to use)
And of course, some new ideas have been raised from the endusers.
Currently we can drag & drop one item at a time from a list of available things into a drop container.
Now the users wish to be able to "select" multiple items (Could for example be a checkbox in each drag source) and then darg&drop them all in one operation.
Actually the components are all displayed in a grid with 3 columns and n rows. (Each item in one grid-cell)
Any idea how to implement this ?
Currently, the only option is to use multi-select in a table and then the [tt]TableDragMode.MULTIROW[/tt] drag mode.
The trivial solution is to use a basket where the selected items are collected, and then D&D the basket.
Well, if you really want to do it for a selection of regular components laid out in a grid, you could also make some incredible hack that wraps the components inside a DragAndDropWrapper dynamically when they are selected. You would probably have to use a AbsoluteLayout, which would require that the items have a fixed size, so that you can easily calculate their coordinates to organize them as a grid. Then, when user selects an item, create another "basket" AbsoluteLayout that is wrapped in a DragAndDropWrapper, within the main AbsoluteLayout and move the selected items there.
so I will just add a checkbox on each drag source, and then when
something is dropped in the target area, I will also "take over" all other items with the checkbox turned on.
So the users will have all items dropped, the only drawback is, that they won't see during d&d that these elemnts also are part of the drag&drop.
But for our usecase this should be ok.