You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Elam Daly <el...@gmail.com> on 2006/02/14 21:41:29 UTC

Setting CSS Programatically

Howdy all,

Is it possible to set the css of row in a dataTable programmatically?  I
have a dataTable bound to a UIData component and I cycle through the rows of
the table and calculate some values.  If the value is greater than a certain
threshold, I need to highlight the entire row, say by coloring it red.  Is
is possible to manipulate the style for that single row?

Thanks,
-Elam

Re: Setting CSS Programatically

Posted by Bruno Aranda <br...@gmail.com>.
No, try it. You will see ;-) . It changes the style of the cells
depending on the condition, so if you put that in all the t:columns
you will have the row with a different colour.

Regards,

Bruno

On 2/15/06, Elam Daly <el...@gmail.com> wrote:
> Hi Bruno,
>
> I could be wrong, but won't this just set the style for my column, not my
> row?  I need to set the whole row a certain style.
>
> I'm playing around with the setRowClasses() method of the HtmlDataTable
> class, but doing it this way is very cumbersome.
>
> -Elam
>
>
> On 2/14/06, Bruno Aranda <br...@gmail.com> wrote:
> > Yes you can using the t:column. Something like this
> >
> > <t:dataTable var="yourVar" ... >
> > <t:column styleClass="#{(yourVar.valueToCheck >
> > backingBean.threshold)? 'styleClass2' : 'styleClass2'}"/>
> > </t:dataTable>
> >
> > Use a managed bean with the exposed "threshold" variable.
> >
> > Hope that helps,
> >
> > Bruno
> >
> > On 2/14/06, Elam Daly <elam.daly@gmail.com > wrote:
> > > Howdy all,
> > >
> > > Is it possible to set the css of row in a dataTable programmatically?  I
> > > have a dataTable bound to a UIData component and I cycle through the
> rows of
> > > the table and calculate some values.  If the value is greater than a
> certain
> > > threshold, I need to highlight the entire row, say by coloring it red.
> Is
> > > is possible to manipulate the style for that single row?
> > >
> > > Thanks,
> > > -Elam
> > >
> >
>
>

Re: Setting CSS Programatically

Posted by Elam Daly <el...@gmail.com>.
Hi Bruno,

I could be wrong, but won't this just set the style for my column, not my
row?  I need to set the whole row a certain style.

I'm playing around with the setRowClasses() method of the HtmlDataTable
class, but doing it this way is very cumbersome.

-Elam

On 2/14/06, Bruno Aranda <br...@gmail.com> wrote:
>
> Yes you can using the t:column. Something like this
>
> <t:dataTable var="yourVar" ... >
> <t:column styleClass="#{(yourVar.valueToCheck >
> backingBean.threshold)? 'styleClass2' : 'styleClass2'}"/>
> </t:dataTable>
>
> Use a managed bean with the exposed "threshold" variable.
>
> Hope that helps,
>
> Bruno
>
> On 2/14/06, Elam Daly <el...@gmail.com> wrote:
> > Howdy all,
> >
> > Is it possible to set the css of row in a dataTable programmatically?  I
> > have a dataTable bound to a UIData component and I cycle through the
> rows of
> > the table and calculate some values.  If the value is greater than a
> certain
> > threshold, I need to highlight the entire row, say by coloring it
> red.  Is
> > is possible to manipulate the style for that single row?
> >
> > Thanks,
> > -Elam
> >
>

Re: Setting CSS Programatically

Posted by Bruno Aranda <br...@gmail.com>.
May it seem so, but believe me... I am going to write an example eventually :-)

Bruno

On 2/15/06, Matthias Kahlau <mk...@web.de> wrote:
> > <t:column styleClass="#{(yourVar.valueToCheck >
> > backingBean.threshold)? 'styleClass2' : 'styleClass2'}"/>
>
> Won't this only affect the column style, but not the row style?
>
>
> Regards,
>
> Matthias
>
> > -----Ursprüngliche Nachricht-----
> > Von: users-return-17088-mkahlau=web.de@myfaces.apache.org
> > [mailto:users-return-17088-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> > von Bruno Aranda
> > Gesendet: Mittwoch, 15. Februar 2006 00:35
> > An: MyFaces Discussion
> > Betreff: Re: Setting CSS Programatically
> >
> >
> > Yes you can using the t:column. Something like this
> >
> > <t:dataTable var="yourVar" ... >
> > <t:column styleClass="#{(yourVar.valueToCheck >
> > backingBean.threshold)? 'styleClass2' : 'styleClass2'}"/>
> > </t:dataTable>
> >
> > Use a managed bean with the exposed "threshold" variable.
> >
> > Hope that helps,
> >
> > Bruno
> >
> > On 2/14/06, Elam Daly <el...@gmail.com> wrote:
> > > Howdy all,
> > >
> > > Is it possible to set the css of row in a dataTable programmatically?  I
> > > have a dataTable bound to a UIData component and I cycle
> > through the rows of
> > > the table and calculate some values.  If the value is greater
> > than a certain
> > > threshold, I need to highlight the entire row, say by coloring
> > it red.  Is
> > > is possible to manipulate the style for that single row?
> > >
> > > Thanks,
> > > -Elam
> > >
>
>

AW: Setting CSS Programatically

Posted by Matthias Kahlau <mk...@web.de>.
> <t:column styleClass="#{(yourVar.valueToCheck >
> backingBean.threshold)? 'styleClass2' : 'styleClass2'}"/>

Won't this only affect the column style, but not the row style?


Regards,

Matthias

> -----Ursprüngliche Nachricht-----
> Von: users-return-17088-mkahlau=web.de@myfaces.apache.org
> [mailto:users-return-17088-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> von Bruno Aranda
> Gesendet: Mittwoch, 15. Februar 2006 00:35
> An: MyFaces Discussion
> Betreff: Re: Setting CSS Programatically
>
>
> Yes you can using the t:column. Something like this
>
> <t:dataTable var="yourVar" ... >
> <t:column styleClass="#{(yourVar.valueToCheck >
> backingBean.threshold)? 'styleClass2' : 'styleClass2'}"/>
> </t:dataTable>
>
> Use a managed bean with the exposed "threshold" variable.
>
> Hope that helps,
>
> Bruno
>
> On 2/14/06, Elam Daly <el...@gmail.com> wrote:
> > Howdy all,
> >
> > Is it possible to set the css of row in a dataTable programmatically?  I
> > have a dataTable bound to a UIData component and I cycle
> through the rows of
> > the table and calculate some values.  If the value is greater
> than a certain
> > threshold, I need to highlight the entire row, say by coloring
> it red.  Is
> > is possible to manipulate the style for that single row?
> >
> > Thanks,
> > -Elam
> >


Re: Setting CSS Programatically

Posted by Bruno Aranda <br...@gmail.com>.
Yes you can using the t:column. Something like this

<t:dataTable var="yourVar" ... >
<t:column styleClass="#{(yourVar.valueToCheck >
backingBean.threshold)? 'styleClass2' : 'styleClass2'}"/>
</t:dataTable>

Use a managed bean with the exposed "threshold" variable.

Hope that helps,

Bruno

On 2/14/06, Elam Daly <el...@gmail.com> wrote:
> Howdy all,
>
> Is it possible to set the css of row in a dataTable programmatically?  I
> have a dataTable bound to a UIData component and I cycle through the rows of
> the table and calculate some values.  If the value is greater than a certain
> threshold, I need to highlight the entire row, say by coloring it red.  Is
> is possible to manipulate the style for that single row?
>
> Thanks,
> -Elam
>