Reputation: 708
I'm having an issue using GWT. I'm building the columns of a cellTable and I want the style of a cell to depends of the value of that cell:
Column<MyProxy, MyProxy> editButtonColumn = new Column<MyProxy, MyProxy>(new ActionCell<MyProxy>("", new ActionCell.Delegate<MyProxy>() {
@Override
public void execute(MyProxy record) {
if (object.isEditable()) {
doSomething(record);
}
}
})) {
@Override
public MyProxy getValue(MyProxy object) {
if (object.isEditable()) {
this.setCellStyleNames("editButtonCell");
}
return object;
}
};
I've checked in debug mode the style "editButtonCell" is applied correctly. But in the HTML generated, the style is missing everytime for the FIRST ROW... It looks like a GWT bug, but maybe you folks have a better explanation.
Upvotes: 1
Views: 4203
Reputation: 64561
I haven't checked but most probably the opening of the cell has already been generated by the time getValue
is called, so setCellStyleNames
will only apply to the remaining cells in the column.
The right way to do it is to override getCellStyleNames
of the column to return the CSS class name or not depending on the cell value.
BTW, you can then extend IdentityColumn
as the getValue
then becomes trivial.
Upvotes: 7