If you supply more information about what you want to do, that would
help.

We're doing dynamic coloring of cells, etc., depending upon the data
provided, in several places with no problems (certainly without having
to write other tags).  One does need to know which CSS styles are
available, of course; that's why I have Appendix C of O'Reilly's book
"HTML & XHTML: The Definitive Guide" bookmarked. ;-)

- Brendan

-----Original Message-----
From: Christian [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 21, 2005 12:32 PM
To: 'MyFaces Discussion'
Subject: AW: <dataTable> Howto conditional formating of single cells
like in Excel?


Thanks for your responses.

Unfortunalely the idea below does not work (at least not in my context).
I did try it with method binding, "style" and "styleClass" "<t:", "<h:".
I surrender and will work on the other tiers of my app now.

The table itself looks great: I am using rowclasses and columnclasses.
CSS is very powerful and it is not unlikely that your idea works in
other contexts. - I say this according to my experience with CSS and JSF
as Newbie - Note: I spent 3 days on CSS and my Tiles setup. It now looks
in the way I want it to have, at least on Firefox ;-), but I experienced
the entire CSS-JSF stuff as not entirely predictable if you just use
some tags provided. I am a control freak, so next time I will write a
tag myself, and I will deeply check out the rendering phase and
renderes. This might help me to understand how CSS/JSF or CSS/Myfaces
really work together.

Regards
Christian
  


Thomas Blattner wrote:
| Hello,
| 
| maybe you could add a style tag to your outputText and bind the value
| to a field in your managed bean. Inside their you could then give
| back a value according your date
| 
| if ( date > shouldbe )
|     return "color:red";
| else
|     return "color:green";
| 
| 
| 
| Am Mittwoch, 21. September 2005 18:11 schrieb Christian:
|| Hello everyone,
|| 
|| I just tried to do conditional table highlighting in <h:dataTable> or
|| <f:dataTable> for a single cell content, without getting a general
|| approach of how to do it. You might help me.
|| 
|| Idea:
|| I want to implement an eyecatcher. Just imagine MS Excel-table cells.
|| In Excel you can define formating rules for cells. Example: If the
|| amout of money is negative, it is to be displayed in red, else it is
|| to be displayed in black. In my app I want to do this with a date
|| field, ie. if the date displayed is lower than the date of today
|| (Usecase: "Something is overdue"), it is to be displayed in red
|| instead of black as usual. 
|| 
|| Situation:
|| My <dataTable> is bound to a managed bean containing a list of
|| dataBeans, works fine. 
|| 
|| #
|| 
|| Things I tried to do:
|| 
|| I tried to do component binding to an HtmlOutputText-Component like
|| 
||| <x:dataTable var="list"
||| [...]
|||     <h:column>
|||         <h:outputText binding="#{list.dateOutputCompontent}"
|| 
|| value="#{list.dateOfReturn}"/>
|| 
|||     </h:column>
||| [...]
|| 
|| I also tried to do something like:
||| FacesContext context = FacesContext.getCurrentInstance();
||| HtmlOutputText dateOutput = null;
||| dateOutput =
||| (HtmlOutputText)context.getViewRoot().findComponent("dueD");
||| dateOutput.setStyle("color:red");
|| 
|| in combination with
|| 
||| <h:column>
|||    <h:outputText id="dueD" value="#{list.dateOfReturn}"/>
||| </h:column>
|| 
|| I put the java-code inside the getter of the date value, which did
|| not work. The table-display-result broke at the rendering of the
|| first date-format. 
|| 
|| Question:
|| Does anyone have an idea of what to do an where to do.
|| 
|| Thanks in advance.
|| Regards
|| Christian


Reply via email to