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.
How to add a combobox in a grid?
Hi all,
I am new to Vaadin.
I was trying to add a combox in a grid.
Code -
Grid grid = new Grid();
grid.setWidth("800px");
grid.setHeight("200px");
grid.addColumn("Rank", ComboBox.class );
ComboBox selectRankComboBox = new ComboBox("");
Integer rank = new Integer {1, 2, 3, 4, 5};
for (int i : rank){
selectRankComboBox.addItem(i);
}
grid.addRow(selectRankComboBox);
layout.addComponent(grid);
Attached is the screenshot of the output.
It is showing the Id
How can I display the combox in a grid?
In Grid it is not possible to add component directly to the cell of Grid. Hence the thing you are attempting to do doesn't work. Instead you could create widget renderer that renders ComboBox or ComboBox like widget (e.g. GWT's ListBox) in Grid's cell.
There are couple of example's here in this add-on.
https://vaadin.com/directory#!addon/grid-renderers-collection-for-vaadin7