File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Datatable Conditional Row Colors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Datatable Conditional Row Colors" Watch "Datatable Conditional Row Colors" New topic
Author

Datatable Conditional Row Colors

Muhammad Ijaz
Ranch Hand

Joined: Mar 03, 2009
Posts: 34
Hi,

I am using the rich:datatable in which I need each row color based on some condition



Now each row should be of a color depending on 'patient.status' value of that row.
for example, if it is hospital patient- it should be blue color, if it is private patient - it should be sky blue color......

Any help will be highly appreciated.

IBM Certified WebSphere Commerce Application Developer

Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

I can think of a solution here but that will violate the rule of concerns "Presentation and Business layer"

You can have some style classes each for a type of color. Now depending on the type of 'patient.status' you will set the property which is used to represent the styleClass.



I assume that you are using a patient Value Object/DTO.
styleClass attribute takes EL expression. I think it takes but not very sure of it. Its a long time I used it.

HTH

My Blog SCJP 5 SCWCD 5
 
Consider Paul's rocket mass heater.
 
subject: Datatable Conditional Row Colors