Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Row not populating after drag and drop
I currently have a table which most of the columns contain complex objects. When I drag the row, a new row is created in the correct location but the data is not displayed. Is there something that has to be done when the columns contain complex objects instead of primitive objects? My drop method is as follows:
public void drop(DragAndDropEvent event) {
System.out.println("DragAndDropEvent");
DataBoundTransferable transferable = (DataBoundTransferable) event.getTransferable();
Object sourceRow = transferable.getItemId();
AbstractSelect.AbstractSelectTargetDetails dropData = ((AbstractSelect.AbstractSelectTargetDetails) event
.getTargetDetails());
Object targetRow = dropData.getItemIdOver();
// Don't move if source and target are the same, or there is no
// target
if ((sourceRow == targetRow) || (targetRow == null)) {
return;
}
// Remove the source of the drag so we can add it back where
// requested
table.removeItem(sourceRow);
// Check if the drop location is somewhere below the row ...
if (dropData.getDropLocation() == VerticalDropLocation.BOTTOM) {
try {
table.addItemAfter(targetRow, sourceRow);
} catch( UnsupportedOperationException uoe) {
uoe.printStackTrace();
}
}
// ... or somewhere in the middle or above
else {
Object rowAbove = table.prevItemId(targetRow);
table.addItemAfter(rowAbove, sourceRow);
}
}
So it seems that you don't do it this way. Even though table has the ability to do a drag and drop you pretty much have to code it yourself using clone. No idea why it is this way. There should be a method like moveAfter in TreeTable.
Since clone is potentially going to go away is there another recommendation for this?