Table row color

Hi,

I’m trying to change the color of a row of a table when a value of that row is true. With what I found on the forum, I made this

Java :


private class ColoredRowGenerator implements CellStyleGenerator {

	@Override
	public String getStyle(Object itemId, Object propertyId) {
		if (propertyId == null) {
			Item item = grid.getTable().getItem(itemId);
			Boolean deleted = (Boolean) item.getItemProperty(DELETED_NAME).getValue();
			if (deleted) {
				return "inactive";
			}
		}
		return null;
	}
	
}

table.css : I use my own custom theme based on chameleon


.v-table-row .v-table-row-inactive,
.v-table-row-odd .v-table-row-inactive {
  background-color: rgb(128,128,128);
}

styles.css


@import url(../chameleon/styles.css);
@import url(table.css);

The stylegenerator is added correctly and in debug I see the “inactive” style is added for rows which are deleted in my case.

I cleaned everything possible in Eclipse and Tomcat. I completely cleaned my browser cache, but still no result.

The table I use doesn’t have additionnal stylenames, but it would be great to get the above working with a “striped” table.

Thanks

Hi

I think you need to add “content” in your css, like this:

.v-table-row .v-table-row-content-inactive,
{
  background-color: rgb(128,128,128);
}

Greetz


.v-table .v-table-row-inactive,
.v-table .v-table-row-odd-inactive {
        ...
        ...
}

I tried your solution, but the result stays the same.

Syam,

your solution did the trick! Thanks.