HTML 5 native dragover event of DataGrid cell never fired
Hi,
I've been having hard time trying to make DataGrid rows sortable with HTML 5 native drag and drop.
I have custom Cell which sinks drag events (see below). If I drag the cell dragstart event is fired but visualization of drag operation is not displayed. Moreover dragover event on other cells in DataGrid is also never fired, which I think is cause of the missing visualization of drag operation. It seems like that drag&drop operation is not initialized properly.
I've tried to create test Label (see below) for which everything works OK, i.e. when dragged dragstart is fired (on Label object). When dragged over Datagrid cells the dragover events are fired on cell's object, even drop event is properly fired.
I suspect DataGrid widget that it swallows the event somewhere in it's onBrowserEvent() but I wasn't able to find the place where it happens.
Does anybody has an idea what's wrong here or what do I do wrong?
public class DraggableTextCell extends AbstractCell<String>
{
public DraggableTextCell()
{
super(
"dragstart",
"drag",
"dragover",
"drop"
);
}
@Override
public void render(
final Context context,
final String value,
final SafeHtmlBuilder sb
)
{
sb.append(mTemplates.textCell(value));
}
@Override
public void onBrowserEvent(
final Context context,
final Element parent,
final String value,
final NativeEvent event,
final ValueUpdater<String> valueUpdater
)
{
final String eventType = event.getType();
if (eventType.equals("dragstart"))
{
log.info("dragStart");
}
else if (eventType.equals(DragEvent.DRAG.nativeType()))
{
log.info("drag");
}
else if (eventType.equals(DragEvent.DRAG_OVER.nativeType()))
{
log.info("dragOver");
}
else if (eventType.equals(DragEvent.DROP.nativeType()))
{
event.preventDefault();
event.stopPropagation();
log.info("drop");
}
}
}
/* Test label */
final Label l = new Label("Draggable");
l.getElement().setDraggable(Element.DRAGGABLE_TRUE);
l.addDragStartHandler(new DragStartHandler() {
@Override
public void onDragStart(final DragStartEvent event)
{
event.setData("text", "test");
}
});
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/YexopyRY3esJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home