Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing color of a specific row in a datatable using icefaces

 
Cesar Huasupoma
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i'm new in icefaces so i have a problem and i hope you can help me.
I have a datatable with data (no problem here) but i need to put a red background colo to an specific row from java because it is suppose to be a restriction from a condition is there a way i can do that?

Example:

i got a table with 5 products and all of them have an expiration date so... 4 products are ok but one has expired 5 days ago so i need to color that row with red
 
Vladimir Mokrozub
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Here, rowIndexVar is an index and rowStyleClass is a style class of current row. In your backing bean set expiredProductIndex to the index (zero-based) of row you want to color with red.
 
Cesar Huasupoma
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was thinking something like that but doing something like this:

I get some data from a query from database so I'm getting this: 1 (true) or 0 (false)
In the bean class i will have a variable called expiredProduct and the get method is called isExpiredProduct
so the code could be:

you think this is ok?
 
Vladimir Mokrozub
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your row objects contain expiredProduct property, this seems ok.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic