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.
Grid: how to populate values inside grid with data source?
Hi guys,
I am data source i.e. a simple pojo that contains set of strings.
public class Example {
private String example1;
private String example2;
//getters and setters
}
and utility like this:
public class ExampleUtil {
public static BeanItemContainer<Example> createExampleContainer() {
BeanItemContainer<Example> container = new BeanItemContainer<Example>(
Example.class);
}
My question is how do I populate the grid using such data source... and populate the grid.
so that I get the grid with column 1.
There is this example ... but how to get rid of random generation of the data from this?
Using the util method above, you can just call container.addBean(example). The BeanItemContainer can also take a collection as a constructor parameter, which would add all beans to the container.
When you've added all items to the container, simply call grid.setContainerDataSource.
Thanks Thomas, for your prompt response.
You encouraged me to call container.addBean(example) and sorted out my minor issue.
Cheers!