aspose file tools*
The moose likes Other Open Source Projects and the fly likes wants to display Cell color in a table based on source value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "wants to display Cell color in a table based on source value" Watch "wants to display Cell color in a table based on source value" New topic
Author

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

Naveenkumar Sannareddy
Greenhorn

Joined: Aug 11, 2011
Posts: 4
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

Joined: Mar 30, 2005
Posts: 56
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

Joined: Aug 11, 2011
Posts: 4
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

Joined: Mar 30, 2005
Posts: 56
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wants to display Cell color in a table based on source value