I am using ListGridField.setCellFormatter() to customize the presentation of selected cells in a ListGrid.
I'd like the "formattedValue" to be the value as it would normally be formatted, just displayed in a red font if the condition is met. But I don't see a way to invoke the standard formatting based on field type.
Is there some way to get the string with standard formatting already applied and then extend that? Or is there an alternative? Maybe setting just the style for the field? I didn't see anything like that in the API but I may have overlooked it somehow.
Code:
field.setCellFormatter(new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value==null) return null; String formattedValue = value.toString(); Integer count = record.getAttributeAsInt(countFieldName); if (count!=null && count>1) return "<font color=red>" + formattedValue + "</font>"; else return formattedValue; } });
Is there some way to get the string with standard formatting already applied and then extend that? Or is there an alternative? Maybe setting just the style for the field? I didn't see anything like that in the API but I may have overlooked it somehow.
Comment