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>(


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
… 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.