Table with Boolean container property

Hi everyone:

I’m trying to create a table with a boolean container property, it shows me a checkbox in each item for this property, however as the checkbox caption it shows me the name of the property’s id… is there a way that i can control that caption?

Hello Miguel,

The way to go is to provide a custom TableFieldFactory. See the example solution below:

table.setTableFieldFactory(new DefaultFieldFactory(){
    public Field createField(Container container, Object itemId, Object propertyId, Component uiContext) {
        Field field=super.createField(container,itemId, propertyId, uiContext);
        return field;


Thank you it worked!!

I have one more doubt. Just to close the topic if the table is not editable it shows me “true” or “false”, can i control those labels with a similiar method?

method has the table as the argument
, so you can check if it is editable and, if not, return eg. Label with required text.

The TableFieldFactory is used when the table is in edit mode. In order to control cell rendering in the normal (read-only) mode, you need to add generated column to the table and produce the cell content in the passed ColumnGenerator.

Note that you could also use generated columns to enable editing of some of the cell values without even setting the Table to the editable mode. In some cases this approach is much cleaner than turning on the edit mode. Also please note that generated columns stay as is if the table is switched to the editable mode.


Thank you!!

The methods setTableFieldFactory and addGeneratedColumn were the ones i was looking for. There are still a lot of things about tables in vaadin that i should learn about.