• Post Reply Bookmark Topic Watch Topic
  • New Topic

Replacing a value with CSS style  RSS feed

 
Tom Swe
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone!

I'm looking for a few pointers as to how to solve this little problem.

I currently have a 2D array of ints (int[8][5]). Each place within this 2D array has a value of either 0 or 1 (for the time being).

Basically what i'd like to happen is....

based on the value (0 or 1) a CSS style is used. I'm currently looking into solutions but i'm not finding too much useful info.

My ultimate goal is to display a table on a jsf page with pre formatted cells based on this CSS style.

I'm looking for advice on how to solve this, not necessarily the answer.

Thank you for your time


 
Stephan van Hulst
Saloon Keeper
Posts: 7962
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So when you're generating the table, what's stopping you from iterating over your array to check the value, and produce the style accordingly?
 
Tom Swe
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote:So when you're generating the table, what's stopping you from iterating over your array to check the value, and produce the style accordingly?


Thanks for your reply.

I've actually done what you suggested. It dawned on me earlier. I basically iterate over the array and replace 0 or 1 with the style i want.

Think i was a having a slow moment! Thanks anyway.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!