Vaadin Grid has addRow missing

I am using Vaadin (Version 8) Grid and there is no addRow call?? But the documentation says there is.

What am I missing?


I also would like to know. My question is how to add an empty row to use with grid editor?


Same here. There is no addRow or getRows. I do not like the idea of resetting/rebinding the whole grid every time a new row is added or deleted.

It also seem like that Table is gone from Vaadin 8. Table was mature and had lots of functionality that are still missing in grid. Most business applications do not require million rows and Table was just fine.

Would like to know the road map for grid. Should I stick to Vaddin 7 for now?

Thanks in advance.

Grid does not appear to be mature and there is a misalignment between the code base and the documentation. The only way I managed to do an update of a new row is by using the following work around:

// entries is a List that is global and defined previously
entries.add(new ExampleEntry(,));

but this is not a real solution. I could not get the DataProvider examples to work either since they do not provide an add or delete mechanism and the refresh did not work on them as documented on my sample DataProvider.

All in all, Table should not have been deprecated. There is always a need for a simple and a complex version of something and one ought not remove the simple version without providing an adequate substitution.

Me too also missing the addRow method, I’ve used this in 7 and really need it back. Anyhelp vaadin ?

I had to add a new empty pojo to my item list and refresh my dataprovider. It works this way.

The problem is I don’t have a standard pojo we are trying to generate a grid at runtime that is defined based on a json payload. I’ll take any ideas that are available.

Did you find any solution, we got it working, let me know if you are interested to know more.


If you don’t want to use a POJO, you can just substitute a Map object or similar. Just define your columns with addColumn() to return the values from a Map.


Hi Sahil yes please still interested, my kungfu ( java :slight_smile: ) is not that great so if you have an example I’d greatly appreciate it. Thanks, I could do this with gird7 but not in 8. Appreciate it

I wrote
this blog post
about it earlier. It deals with LocalDates so it’s slightly complicated for a basic example, but you should get the idea.


Ok, here is what we do:

1- We use a POJO with two fields “id” that contains unique row item identifier and “json” that holds as values in JSON (you could use a map as well instead)

public class GridItemBean implements Serializable {
private String id;
private JSONObject json;
public GridItemBean(Object id, JSONObject json) { = String.valueOf(id);
this.json = json;
public String getId() {
return id;
public JSONObject getJson() {
return json;

So you can create a collection of these items and set it on grid (grid.setItems(…))

2- When adding columns on grid, based on your data type (String/Date/Tmestamp/Double/Integer etc) set an appropriate provider

, currentView.types[i]
, null));

Here is my provider factory that picks up the appropriate provider:

public class Provider {
public static ValueProvider getProvider(String column, Class<?> type, AppField field) { // Boolean if (Boolean.class.isAssignableFrom(type)) { return new BooleanValueProvider(column); } // Integer else if (Integer.class.isAssignableFrom(type)) { return new IntegerValueProvider(column); } // Double else if (Double.class.isAssignableFrom(type)) { return new DoubleValueProvider(column); } // Date else if (Date.class.isAssignableFrom(type)) { return new DateValueProvider(column, field); } // Time else if (Timestamp.class.isAssignableFrom(type)) { return new TimeValueProvider(column, field); } // DateRange else if (DateRange.class.isAssignableFrom(type)) { return new DateRangeValueProvider(column); } // default to String else { return new TextValueProvider(column); } } @SuppressWarnings("rawtypes") public static ValueProvider getProvider(String column, Class<?> type) {
return getProvider(column, type, null);

3- Here is a sample Date provider that finds and renders date value from GridItemBean:

public class DateValueProvider implements ValueProvider<GridItemBean, Date> {
private final String column;
private final AppField field;
public DateValueProvider(String column, AppField field) {
this.column = column;
this.field = field;
public Date apply(GridItemBean source) {
if (JSON.hasValue(source.json, column)) {
if (field != null) {
if (field.isProxyField()) {
return new Date(JSON.getLong(source.json, column));
} else {
final JSONObject value = JSON.object(source.json, column);
return new Date(JSON.getLong(value, “start”));
} else {
return new Date(JSON.getLong(source.json, column));
} else {
return null;

You can also go for a renderer to format the values in grid columns, something that we use extensively but that depends entirely on your needs.
To set a renderer, once you set a provider, you can use;

column.setRenderer(new DateRenderer(dateTime));

That’s a nice approach as well!