Multi-Row Drag and Drop strange behavior

Hi Guys,

I am experiencing some strange behaviour with a table drag and drop. I have it configured for the table to drop multi-rows onto other rows.

The issue is, if a row is selected and you drag on another row (that is not selected) a drag will begin with the unselected row. My understanding is that if the DragMode is set to MULTIROW I should
not
be able to start a drag by dragging unselected items.

Test Code to reproduce:


public class TableMultiSelectApplication extends Application {
	@Override
	public void init() {
		Window mainWindow = new Window("Table Application");
		Table t = new Table("Table");
		t.addContainerProperty("Id", String.class, null);
		t.addItem(new Object[]{"1"}, new Integer(1));
		t.addItem(new Object[]{"2"}, new Integer(2));
		t.addItem(new Object[]{"3"}, new Integer(3));
		t.addItem(new Object[]{"4"}, new Integer(4));
		t.addItem(new Object[]{"5"}, new Integer(5));
		t.addItem(new Object[]{"6"}, new Integer(6));
		t.setSizeFull();
		t.setSelectable(true);
		t.setMultiSelect(true);
		t.setDragMode(TableDragMode.MULTIROW);
		mainWindow.addComponent(t);
		setMainWindow(mainWindow);
	}
}

So in this example, if you select items 3 & 4, and then drag item 1, a new drag will initiate with record #1. Running Vaadin 6.7.9.

Let me know if I have something setup wrong.

Cheers,
~Ben

PS: I also noted that if I shift-select 3 items and drag them, the drag overlay only shows 1 record. When you command-select 3 items it shows all 3. This is purely a graphical issue though, where as the first issue I can’t work around.

Can anyone else verify this behavior?

Is nobody else having this issue? This bug basically makes table drag and drop unusable.

The behavior of Vaadin matches that of e.g. Windows Explorer and Nautilus on Linux - if you start a drag from an unselected item, only that item is dragged.

Hi Henri,

Oh wow you are right. I have never noticed this - to me that seems bizarre - surely the dragged row should become selected - anyway so its not a bug. Has the documentation been updated on this, I can’t seem to find the reference to drags not starting if other rows are selected. PS: this drag behavior is the same on Mac OS X as well.

Thanks for your help!

~Ben