set data to Grid

Hi my previous experience was about Swing.
Are there any other ways to set data to Grid except setItems(object) either binded or not? For example to JTable you could have 2 dimension array or ArrayList. If there are can you point me to examples?

Thank you in advance


You can use setItems that takes a Collection but also a dataprovider:

Hi and thanks for the answer.
Can you please give a sample of Collection code used with Grid?

My objective is to use Grid like grid.setItems(Record) where Record is a class with variable number of parameters each time.

Any suggestions?


The grid component helps you to: (in short)

  • create a column that renders a data (A Java lamdba expression for example)
  • set a collection a data


Grid<Record> grid = new Grid<>();
// build all the needed columns
grid.addColumn(record -> record.getYourData()); 
grid.setItems(records); //records is a list or collection of record

Record can contain anything but you need to know which column you will show.