• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Always! Wait. Never. Shut up. Look at this tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic