Sorted Editable Grid with new data (bean) throws NPE

I have a grid which is editable and should be sorted. Without sorting everything works fine. But when I add grid.sort(firstColumn); it bails out with a NPE when I add a new bean where the fields have null values.

Caused by: java.lang.NullPointerException: value cannot be null
at java.util.Objects.requireNonNull([:1.8.0_111]

at com.vaadin.ui.AbstractTextField.setValue(
at com.vaadin.ui.AbstractTextField.setValue(

at java.lang.Iterable.forEach([:1.8.0_111]


at com.vaadin.ui.components.grid.EditorImpl.doEdit(
at com.vaadin.ui.components.grid.EditorImpl$1.bind(
... 39 more

[/code]Can I set somewhere my own comparator which handles null values? Or is there any other workaround?

Thanks in advance.


Yes, that is possible when you use ListDataProvider instance in Grid, it has a method addSortComparator()

Here is the interface you should extend

Thanks. That did the job.