This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wants to display Cell color in a table based on source value

 
Naveenkumar Sannareddy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP page in which i am using display tag to display the information in table format.
I have a column called TICKET COLOR whose attributes are red,blue,green,yellow etc...

I have to make display the cell under TICKET COLOR columns colored based on the attribute value.
That is if the first attribute is red,then the background of that cell must be red and so on.
Remember this coloring must be only confined to that cell, not to the entire row.

Can anybody show me a way how to move forward.



Thanks,
Naveenkumar.S
 
Ajeeth Kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though this looks like a difficult problem, the solution is simple. Just using stylesheet and javascript you can change the appearance of your webpages.
Whenever the user selects a particulat TICKET color from the dropdown invoke a javascript method like setColumnColor(selectedColor).



Within that method, set the styles of the cells as follows
 
Naveenkumar Sannareddy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Ajeeth,

My Problem is a little different, let me tell you my question clearly.

In my JSP page i am displaying data in table format, we have used Display tag extensively for that, Please the find the line of code below.


In the above code this line will fetch the value of color and display it in table cell, so while displaying the table values first time itself i need to display that Ticket Color column to display the cells under it based on the source value which i get from DB, that is if CELL 1 contains the value RED,the background must be red for that cell.
This must be done at the first time of displaying the page, and not on mouse click or any other events.

Is there any way i can do it without removing the Display tag.

Thanks in advance..
 
Ajeeth Kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Naveen, I haven't used dsiplay tags in the last 5 years, so I am not sure of the best and easy way to do that.

I can think of a solution where you can call a script on page load to set the column colors but Lets wait to see if some other ranchers have an answer for this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic