Reorder a vertical layout with Drag & Drop

Hi, any help on how to reorder components in a vertical layout with standard vaadin8 Drag & Drop ?

Thanks

One problem is that you don’t get the drop position on the DropTarget component. If your VerticalLayout is your only DropTarget, you can just get the information that the dragged component was dropped on the VerticalLayout and that’s it - you can’t really reorder anything based on that information alone. If your draggable components are drop targets too, you could (for example) switch the positions of two components quite easily; if that’s enough for you, good. If you can live with the v8 compatibility libraries, you could use this add-on: https://vaadin.com/directory/component/dragdroplayouts

Hello,

Thanks for the reply.

will I use dragdroplayout, despite it use compatibility?

hope for future support for the release position on layouts

Thank you

Giovanni Adobati:
will I use dragdroplayout, despite it use compatibility?

That’d be your easiest option, I suppose.

hope for future support for the release position on layouts

Me too!

Olli Tietäväinen:

Giovanni Adobati:
will I use dragdroplayout, despite it use compatibility?

That’d be your easiest option, I suppose.

hope for future support for the release position on layouts

Me too!

Are there news in vaadin 14 for vertical layout reordering ?

Is there a way to know during a drop target event wich is the index where the drop source is over ?

For instance i use a vertical layout as a drop target and i want to reorder components in it.

Any ideas ?

I’m thinking you will need some other component than a (plain) VerticalLayout. It relates to what I already stated above - VerticalLayout is a single element, which is identified as a drop target without additional information about where the dropped component lands. You would need additional elements inside the VerticalLayout to act as drop targets to know where the drop occurred.

Olli Tietäväinen:
I’m thinking you will need some other component than a (plain) VerticalLayout. It relates to what I already stated above - VerticalLayout is a single element, which is identified as a drop target without additional information about where the dropped component lands. You would need additional elements inside the VerticalLayout to act as drop targets to know where the drop occurred.

Hi Olli,
thanks for the suggestion,

may be i can create a component composed of a top / bottom drop area and a content area in the middle.
Than extend a vertical layout that use it as a component item.

could be an idea ?

Thanks

Sounds like it could work!

Ok,

I’ll try it.

Thanks
Bye