Hi, I am trying a theoretically easy drag and drop over a GWT 2.5.1 Grid 
component using the native DnD. I want to drag the id (as String) of a row 
and drop in different position just to change the order of rows. The 
process I followed is:

* Initially I tried to drag from the Grid itself as source but then I would 
not know how to identify the dragged row.

* So I then thought to drag from a cell/row itself, but I do not know how 
to attach the drag events to the cell/rows

* So finally, I decided wrapping my text content on a Label placed within 
the Grid cell. With this approach I managed to drag the id of the item with 
no problems:

final Label label = new Label("blah blah blah item");
label.getElement().setDraggable(Element.DRAGGABLE_TRUE);
label.addDragStartHandler(new DragStartHandler() {
@Override
public void onDragStart(DragStartEvent event) {
String id = "successfully calculated_id";
event.setData("item", id);
}
});

Then again the same problem for the drop target.

* Ideally I would assign the target to the Grid so I can drop in the middle 
of 2 rows. However no drop event looks to be fired at any time. And, even 
if it would be fired, again I would not know how to calculate the row/cell 
number receiving the drop event.

* So, again I tried assigning the drop target to the same Label instances 
as:

label.addDropHandler(new DropHandler() {
    @Override
    public void onDrop(DropEvent event) {
System.out.println("stop: ");
        // prevent the native text drop
        event.preventDefault();
    }
});

but no drop event looks to be fired. Finally trying to create the drop by 
using a DOM Handler:

label.addDomHandler(new DropHandler() {
    @Override
    public void onDrop(DropEvent event) {
System.out.println("stop: " + event.getSource());
        event.preventDefault();
        // Do something with dropLabel and dragging
System.out.println("stop: " + event.getSource());
    }
}, DropEvent.getType());

again no drop event fired.

So, at the end:
* no problem dragging the id from the source row
*  but looks impossible to trigger a event for the target item, not mater 
if it is a Label or the Grid itself. 

My browser is FF and my API is the Native GWT 2.5.1 DnD. Any 
idea/advise/experience/example?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to