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);
}
}