Is there a way to color a table cell based on two column values?
I see this in the documentation:
addNumericCondition(String condition, Integer value1, String align, String color, String style, String weight, String target)
which works great for one condition, but if you start adding more conditions — the future conditions override it…Here’s what I’m doing:
var defaultRenderer = new qx.ui.table.cellrenderer.Conditional("left", "", "", "");
defaultRenderer.addNumericCondition("==", true, null, "#000000", null, null, "Verified");
defaultRenderer.addNumericCondition("==", false, null, "#000000", null, null, "Verified");
var nawasdNotVerified = new qx.ui.table.cellrenderer.Conditional("left", "", "", "");
nawasdNotVerified.addNumericCondition("==", true, null, "#FF0000", null, null, "NAWASed");
nawasdNotVerified.addNumericCondition("==", false, null, "#FF0000", null, null, "NAWASed");
table.getTableColumnModel().setDataCellRenderer( 0, defaultRenderer);
table.getTableColumnModel().setDataCellRenderer( 0, nawasdNotVerified );
);
Thanks for the help!
The default conditional renderer does not offer such a feature. But it could be extended easily. Overriding the method _getCellStyle of the Conditional renderer gives you access to the cellInfo object which contains the raw data of the current row (cellInfo.rowData). Having that, you can decide based on whatever data you like in that row how to style your cell.