generateCell not used when calling new ColumnGenerator

Hi,

Here is my table:

[code]
// Columns
table.addContainerProperty(“rendezVous”, Date.class, null, “RDV”, null, null);
table.addGeneratedColumn(“rendezVous”, new DateColumnGenerator());

// Datasource
transports = Datasource.getDatasource().getList();
BeanContainer<String, MyBeanContainer> beans = new BeanContainer<String, MyBeanContainer>(MyBeanContainer.class);
beans.setBeanIdProperty(“id”);

// Rows
table.setContainerDataSource(beans);
for(MyItem myItem : items){
beans.addBean(new MyBeanContainer(myItem));
}

    // Visibility

// table.setVisibleColumns(new Object{“rendezVous”});

    // Autres options
    table.setImmediate(true);

[/code]Here’s my DateColumnGenerator:

public class DateColumnGenerator implements ColumnGenerator {
    private static final long serialVersionUID = -7636137310905040907L;

    @Override
    public Object generateCell(Table source, Object itemId, Object columnId) {
        if(source.getItem(itemId).getItemProperty(columnId) instanceof Date){
            Date date = (Date) source.getItem(itemId).getItemProperty(columnId).getValue();
            SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
            return new Label(sdf.format(date));
        }
        
        return null;
    }

}

My “RDV” column becomes empty when I call new DateColumnGenerator(), and breakpoint doesn’t work on generateCell. Others columns are showed correctly. Anyone know what i’m doing wrong?

Thanks

I’ve found, i cannot compare source.getItem(itemId).getItemProperty(columnId) with intanceof Date, i should use source.getItem(itemId).getItemProperty(columnId) .getType().equals(Date.class) instead.

It’s working now

Good to hear,

I think you could also replace the row

table.addContainerProperty("rendezVous", Date.class, null, "RDV", null, null); with something like

table.setColumnHeader("rendezVous", "RDV") 

You are using external container data source so there is no point in adding container properties to table.

Regards,
Matti