Immediate table content update

Hello,
I have question about table content update. In my app. user select item in table and this item should immediately change icon. I do not know why, by icon shows only after table is sorted. Right now I found only one workaround for this problem make table detach and after attach. I read about same problems on forum, but almost all solve this problem by table sorting. But from my point of view this is not “nice” solution of this issue. May be someone have another variants for this problem.

Thanks for your advice.


Table table = new Table() {
			@Override
			protected String formatPropertyValue(final Object rowId, final Object colId, final Property property) {
				if (property.getType() == CouponType.class) {
					CouponType type = (CouponType) property.getValue();
					return type.getName();
				}
				return super.formatPropertyValue(rowId, colId, property);
			}
			@Override
			public void setItemIcon(final Object itemId, Resource icon) {
				if(helper.isCouponValid((Coupon) itemId)){
					icon = new ThemeResource("../appk/icons/ok-small.png");
				}
				super.setItemIcon(itemId, icon);
			}
		};
		table.setCellStyleGenerator(new CellStyleGenerator() {
			@Override
			public String getStyle(final Object itemId, final Object propertyId) {
				if (helper.isCouponValid((Coupon) itemId)) {
					return null;
				}
				return "red";
			}
		});
		table.addListener(new ItemClickListener() {

			@Override
			public void itemClick(final ItemClickEvent event) {
				Table table = (Table) event.getComponent();
				table.setItemIcon(event.getItemId(), null);
				[color=#FF0000]
[b]
//FIXME: Workaround for table update
[/b]
[/color]
				table.detach();
				table.attach();
			}
		});

		// Style
		table.setRowHeaderMode(Table.ROW_HEADER_MODE_ICON_ONLY);
		table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
		table.setSizeFull();
		table.setStyleName("coupon-usage-min");
		table.setImmediate(true);
		table.setSelectable(true);

		BeanItemContainer<Coupon> beanItemContainer = new BeanItemContainer<Coupon>(Coupon.class);
		beanItemContainer.addAll(couponList);
		table.setContainerDataSource(beanItemContainer);

		table.setVisibleColumns(new String[] { "id", "type" });