Is it possible to combine both rowStyleClass and rowClasses ?
Basically, I want to have alternate colors for the rows (like red and blue), and a third color (yellow) only for one selected row ?
Is it possible to do this ? Thanks in advance.

On 3/22/06, James Reynolds <[EMAIL PROTECTED]> wrote:
Thanks Greg, you've made my day!

-----Original Message-----
From: Lindholm, Greg [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 22, 2006 11:21 AM
To: MyFaces Discussion
Subject: RE: Style for row in datatable

Yes, it's EL so you can use any valid _expression_.
Also, you can test any property in your row object it doesn't have to be
a displayed column.


-----Original Message-----
From: James Reynolds [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 22, 2006 1:08 PM
To: MyFaces Discussion
Subject: RE: Style for row in datatable

So you have a column in your data that determines the row style based on
the conditional statement in your rowStyleClass (pretty cool, I didn't
know you could code an if statement that way).

Is it also possible to evaluate the value of a numeric field?  Such as:
...
rowStyleClass="#{myRow.totalRevenue gt 0 ?
'BlackFontStyle':'RedFontStyle'}"
...


-----Original Message-----
From: Lindholm, Greg [mailto:[EMAIL PROTECTED] ]
Sent: Wednesday, March 22, 2006 10:51 AM
To: MyFaces Discussion
Subject: RE: Style for row in datatable

Yes, it's easy using <t:dataTable>

<t:dataTable
        id="myTable"
rowStyleClass="#{myRow.active ? 'ActiveRowStyle':'InactiveRowStyle'}}"
        var="myRow"
        value="#{myBean.values}">



-----Original Message-----
From: James Reynolds [mailto: [EMAIL PROTECTED]]
Sent: Wednesday, March 22, 2006 12:37 PM
To: MyFaces Discussion
Subject: RE: Style for row in datatable


I have been interested in this as well.  One suggestion that has been
offered in the past is to bind the dataTable row styles to a bean value.
The bean value would be a comma delimited string of class names, one for
each row.  Obviously, you would need to build that list dynamically
based on some aspect of your data.  I haven't tried it yet so I can't
provide any feedback on its success, but maybe the idea will help you.

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 22, 2006 5:19 AM
To: users@myfaces.apache.org
Subject: Style for row in datatable



Hi,

Is it possible to apply a style to a row in a datatable dynamically? For
example, I might have a datatable showing a list of numbers and I would
want the rows containing negative numbers to be red and the positive
numbers to be blue. I want to apply the style to the entire row (<tr>)
not just the contents.

I believe this cannot be achieved using the rowClasses attribute of the
datatable.

Is there any way of achieving this?

Thanks

Jean





Reply via email to