Table CellStyleGenerator and cells updates

Hi everybody,
I need to update cell values based on some criteria. I thought to do that on the table CellStyleGenerator, updating cell values together with cell styles. The problem is that the code in CellStyleGenerator updates only cell styles, leaving unchanged the values…

Is it correct to update cell values on CellStyleGenerator? Or do I need something else?

Here is the code I used:

Can you try with
Item item = table.getItem(itemId);
Property property = item.getItemProperty(propertyId);
property.setValue(“xyz”);

table.refreshRowCache();

Thanks Bharat, however it does not work… I get correct values only after refreshing the browser page…

Another option can be extend your Table and override
protected String formatPropertyValue(Object rowId, Object colId,
Property property)

Thanks Bharat it worked :slight_smile:

The solution was to extend Table overriding formatPropertyValue(), so that formatPropertyValue() handles cells values and CellStyleGenerator handles cells styles…

Here is the code:


final Table table = new Table("My Table") {
    @Override
    protected String formatPropertyValue(Object rowId,
            Object colId, Property property) {
        
    	if(mycondition) {
			return "";
		}				    					       

        return super.formatPropertyValue(rowId, colId, property);
    }
};