PDA

View Full Version : Drag and Drop and BeanModel



mask_hot
6 Jan 2011, 4:56 AM
Hi, I'd like to represent a BeanModel as a Draggable object (a square).
My BeanModel contains 3 fields : a name and x and y coordinates.
I'd like to display a list of BeanModels in a container, disposed according to their x and y fields.
I will be able to drag them in the container and I want to save their new position.

Is it easily feasible? In my mind I think have to use maybe a Template and make it draggable?
In fact : How could I bind a Draggable and a BeanModel?

thx for your help

mask_hot
7 Jan 2011, 12:18 PM
I did a few years ago a workable version in ExtJS based on ExtJS DataView, so I tried to use GXT ListView and ListViewDragSource and a ContentPanel as DropTarget but it's not very successful.
I'm just asking for some leads : should I base my code on the Basic Dnd example (with Html objects) or am I on the good way with the ListView?

sven
7 Jan 2011, 5:52 PM
The approach you posted here should work. ListViewDragSourceh with a ContentPanel and a DropTarget


The DropTarget should create a real component on dragdrop and the specific coordinates.

mask_hot
9 Jan 2011, 4:53 AM
I changed my strategy by designing a grid with layoutContainer as dropTargets (40 squares) and Html components as dragSources.
I made it work. Maybe I'll retry with ListViewDragSource.