I would like to add a Component that I found in the Vaadin Directory (MultiFileUpload) as a Button in a Cell.
I found the tutorial which uses ImageRenderer or ButtonRenderer. But how can I simply add composition of Control or different control to a Grid. For Tables there was the possiblity to overwrite the method table.addGeneratedColumn(…). is there an equivalence to Grid?
Mmm, seems to be a bigger problem. I removed the Button from the Grid and Put it into the Toolbar, so if you click the Button, I fetch the selected row.
But at least, there should be a easy way to add several Compontens to a GridCell.
Components are not supported in Grid cells by design. Support may be added at some point, but doing it properly is a difficult problem (Table emphatically did not do it properly). The problem is that Vaadin components have identity but Grid cells don’t (they are reused when the Grid is scrolled). Renderers can be used to display reusable widgets (eg. ButtonRenderer only renders as many buttons as there are cells on the screen, and only the buttons’ captions are updated when scrolling). For performance reasons, support for full Vaadin components should probably be done the same way, but this would be very unintuitive for people who are used to how components traditionally work.
At some point a “LayoutRenderer” was planned but it was dropped due to open design questions and time pressure. It would have allowed composition of several Renderers per cell.