Grid Editor UI question

Hi guys,

Currently I’m developing a webapp using Vaadin 7.5 and I stumbled across and issue I have not been able to solve by reading this community or other online sources. My problem as follows…

I have applied the editor UI to my grid, via the myGrid.setEditorEnabled(true). As for now, I know how to change the Save and Cancel captions, but I have not been able to do much else.

For example, on my Grid I have formatted some dates to appear as “2015-Dec-16” by using the DateRenderer. But once I double click on the editor, I lose temporarily that format while editing. This happens not only for dates, but any other format.

Could you guys shed a light on my issue? I appreciate your help very much.

Jose Cuadra

Hi Jose!

The Renderer doesn’t affect the Editor, as you have noticed. You need to set an editor Field to the column instead. In the case of a date you want formatted, you can use the DateField, which can take a date format like DateRenderer.

Sample code:


    Column dobColumn = grid.getColumn("dateOfBirth");
            new DateRenderer(new SimpleDateFormat("yyyy-MMM-dd")));
    DateField df = new DateField();

[/code]You could also use PopupDateField; see more information about date editing Fields here:

Documentation regarding Fields:

A Wiki article about creating a completely custom Field:

You can also see the very simple demo app here:

Best regards,

Olli Tietäväinen
Vaadin Developer