I´ve create a special column component which allows you to define different styles and more for the cells. It just needs some testing. I think I will have commited it tomorrow.
Best Regards, Mathias > -----Original Message----- > From: Richard Wallace [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 28, 2005 5:42 PM > To: MyFaces Discussion > Subject: Re: Variable cell style classes in data table > > > Alright, well my back is sort of up against a wall now. I > had thought I > could figure out an alternative for now but I was wrong. I > had thought > that wrapping the column data in a div and setting the width > and height > to fill the cell would allow me to change the background > color on a per > cell basis. And it does, but with a big but. Apparently you > can't use > vertical alignment on block level elements. So, rather than the text > being centered vertically and horizontally as it needs to be, > it's up at > the top of the cell. We've tried several workarounds, none of which > seem to work quite right. > > So, I'm back to needing to set table cell style classes based on the > content of the cell. I looked at maybe modifying the data > table so that > the column classes attribute could be a list of EL statements > that get > interpreted when each cell is rendered, but they are > interpreted instead > when the table itself is created it looks like, so that's > out. I'm not > sure what could be the best way to do it now, maybe create a > new facet > type named "style" or "styleClass" for the column component. > > This is my first bout at trying to create custom components, > so I'm not > sure what that would involve, but I'm more than willing to give it a > shot if someone could maybe give me some advice. > > Thanks, > Rich > > Richard Wallace wrote: > > > Jesse Alexander (KBSA 21) wrote: > > > >> I did something similar, but I just needed to render an > image according > >> the content of a field. > >> > >> I ended up writing a Lookup-image component. Nothing complicated. > >> > >> hope this helps > >> Alexander > >> > >> PS: I'll be offline for a week! But after august 2nd i can scetch > >> up a component that does this trick, if you can wait till then. > >> > >> > > Sounds good. I can probably figure something out until > then. Thanks > > a ton. > > > > Rich > > > >> -----Original Message----- > >> From: Richard Wallace [mailto:[EMAIL PROTECTED] Sent: > >> Monday, July 25, 2005 7:52 PM > >> To: MyFaces Discussion > >> Subject: Variable cell style classes in data table > >> > >> Hey everyone, > >> > >> I've got a report that I'm displaying with <h:dataTable>. > Depending > >> on the value to be displayed the background color of the > cell should > >> be a different shade. So for low values, it'd be like a > really light > >> yellow, for high values it'd be a much darker yellow, etc. > Any ideas > >> on how I can accomplish this with MyFaces? > >> > >> I had sort of hoped that something like the following would work: > >> > >> <h:column styleClass="#{reportHandler.styleClass}"> > >> > >> But, as I found out, styleClass isn't a valid attribute for the > >> <h:column> element. > >> > >> Any ideas? Am I stuck rendering this sucker with plain > old JSP and > >> JSTL? > >> > >> Thanks, > >> Rich > >> > >> > > > >