Adding images to Data Grid Editor

I have added an image to my Data Grid using the DataGrid.ColumnGenerator and returning the path to my image resource in the getValue() method. This image works as expected in the Data Grid until I double click the grid to edit the fields in line. Once the grid enters the edit mode my image is lost.

I have been trying to create a new Editor Field on my column using the setEditorFieldGenerator method but cannot seem to find a way to add my image as this method is expecting a type of Field to be returned and I cannot find a Field type that stores an image as its value.


You’re right, the DataGrid Editor requires Field components. But you can assign some of the field components to the image field to let it be editable. For instance, if image source is represented by String (theme resource, URL, etc.), you can use TextField to edit this value or use PickerField for FileDescriptor. But you cannot assign some not Field read-only component to show it in the Editor. This particular restriction relates to the Vaadin Grid component which is used as Web representation of DataGrid.


Thanks for the clarification.