how can i conditionally highlight/color a row based on the date value of that row...
i searched around and found that i can use the rowStyleClass property of the datatable and make it point to a bean so the bean will return a string that corresponds to a class in the CSS...
however, how do i get each row's data in the getter of that string property...
at the datatable,
rowStyleClass=#{bean.rowStyleClass}
in the bean,
public String getRowStyleClass() {
if (this) {
return "this color"
else {
return "that color"
}
another way i know of is to use the "if else" statements in the expression languages, but how do i compare dates there?
if the date is 30 days ago, highlight it...
conditional formatting in datatable
Hi!
What I do in such cases, that I add a true/false boolean or 0-1 integer column in my datamodel, and set it accordingly to my formatting criteria. Then I use this "hidden" column in the rowStyleClass property or any style property with a simple EL expression like #{data.colorcolumn == true ? 'color: red' : 'color: white'} or similar.
byr
What I do in such cases, that I add a true/false boolean or 0-1 integer column in my datamodel, and set it accordingly to my formatting criteria. Then I use this "hidden" column in the rowStyleClass property or any style property with a simple EL expression like #{data.colorcolumn == true ? 'color: red' : 'color: white'} or similar.
byr
Jboss AS 7.1.1, JSF 2.1.14, PrimeFaces 3.5 SNAPSHOT
-
- Information
-
Who is online
Users browsing this forum: No registered users and 39 guests