Table cell in-line editing

The Table class is very useful for displaying data, but if I want to make something editbale i looks and behaves terribly. I’m new to Vaadin so maybe I just misunderstood someting:

  1. Can I mark columns as editbale or not?

  2. Can I make only the selected/focused row editable?

  3. Can I make a single cell editable only when I select it?

  4. If the standard Table class can’t do this, is there some add-on that can?



  1. Yes, you can.
  2. Yes, you can.
  3. Not sure…


Have a look at the
TableFieldFactory usage

table.setTableFieldFactory(new TableFieldFactory () {
    public Field createField(Container container, Object itemId,
            Object propertyId, Component uiContext) {
        TextField field = new TextField((String) propertyId);
        // If you want to disable edition on a column, use ReadOnly
        if ("Not Editable".equals(propertyId))
        else { // The numeric column
            // The field needs to know the item it is in

// You can also add condition on itemId & current selection
//ex for a mono selection table:
if(table.getValue() != null && table.getValue().equals(itemId))

        return field;

//Don't forget to set your table editable, otherwise the TableFieldFactory won't be used

Hope it helps

Thanks for helping… I suppose I should have read the Table chapter in the Book of Vaadin before posting that question. It even states in the first paragraph that “clicking on a cell could change it to a text field for editing”. Browsing through the chapter I don’t think the author was explicit about how he recommends that to be implemented, but I can see that it’s possible.

Now that I know a little more I don’t think using a Table with editable columns/cells suits my needs - seems messy and backwards to implement. Starting from scratch with a GridLayout seems much “easier”.


Hi Anders Peterson,
How you achieve “clicking on a cell could change it to a text field for editing”. Please post your code. I am trying to achieve this for long time. But still I cant.


Actually it’s quite easy… (depending on exactly what you require) I use generated columns. Have the ColumnGenerator return a TextField that listens to FieldEvents.FocusListener and FieldEvents.BlurListener and set the read only flag as needed.


void addGeneratedColumn(Object id, ColumnGenerator generatedColumn)