Hi,
I have a problem with a table, I have a generate function for a column that return a different string with a condition.
This is the column:
<column id="generatedColumnCondizione" generator="generateCellCondizione" />
The function:
public Component generateCellCondizione(InternalTag entity) {
if (entity.getValue() == 0) {
cell = new Table.PlainTextCell("OK");
} else {
cell = new Table.PlainTextCell("KO");
cell.setStyleName("color-red");
}
return cell;
}
in the login.css I have insert
.v-table-cell-content.color-red {
background-color: red;
}
I would that in the case “KO” the background cell is red, but I have the following error:
Caused by: java.lang.RuntimeException: Exception in declarative Table column generator generateCellCondizione
at com.haulmont.cuba.gui.xml.DeclarativeColumnGenerator.generateCell(DeclarativeColumnGenerator.java:82) ~[cuba-gui-7.2.8.jar:7.2.8]
at com.haulmont.cuba.web.gui.components.WebAbstractTable$1.generateCell(WebAbstractTable.java:2491) ~[cuba-web-7.2.8.jar:7.2.8]
at com.vaadin.v7.ui.Table.parseItemIdToCells(Table.java:2333) ~[vaadin-compatibility-server-8.9.2-15-cuba.jar:8.9.2-15-cuba]
at com.vaadin.v7.ui.Table.getVisibleCellsNoCache(Table.java:2203) ~[vaadin-compatibility-server-8.9.2-15-cuba.jar:8.9.2-15-cuba]
at com.vaadin.v7.ui.Table.refreshRenderedCells(Table.java:1746) ~[vaadin-compatibility-server-8.9.2-15-cuba.jar:8.9.2-15-cuba]
... 66 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_251]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_251]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_251]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_251]
at com.haulmont.cuba.gui.xml.DeclarativeColumnGenerator.generateCell(DeclarativeColumnGenerator.java:80) ~[cuba-gui-7.2.8.jar:7.2.8]
... 70 common frames omitted
Caused by: java.lang.UnsupportedOperationException: null
at com.haulmont.cuba.gui.components.Table$PlainTextCell.setStyleName(Table.java:1472) ~[cuba-gui-7.2.8.jar:7.2.8]
at com.skyfield.webfep.web.screens.internaltag.InternalTagBrowse.generateCellCondizione(InternalTagBrowse.java:61) ~[webfep-web-0.1-SNAPSHOT.jar:na]
... 75 common frames omitted
Any suggest?
thanks