aspose 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Datatable Conditional Row Colors
 
Similar Threads
dataTable with dynamic number of rows and columns
Command link with Javascript in Datatable
How to get row index in a dynamic table?
Data from search not being dynamically added to rich:dataTable
display multiple rich:dataTables