Thursday, 27 September 2007

ADF Tables. Changing the colour of negative valued columns

My users asked me if it would be possible to display negative values of an ADF table using a different colour than the rest.

The solution turned out to be something as simple as defining two CSS classes like this :

.redFont {
    color: Red;
}
.blueFont {
    color: Navy;
}

The last step was to bind the StyleClass property of the adf:outputText elements using the following EL expression :

#{row.myColumn.value > 0 ? 'blueFont' : 'redFont'}

No comments :