• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Datatable Conditional Row Colors

 
Muhammad Ijaz
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic