1 Reply Latest reply on Oct 16, 2011 7:06 PM by healeyb

    Giving style to a column in Richfaces Datatable based on value in each cell

    stuffedfaces

      Hi!

       

      I am looking for a way to give style to each number in a column of a datatable, based on whether the number is negative or non-negative. For example the number would be red if negative and green if non-negative.

       

      Example:

       

          

      ...
      Transaction

      -$25.00

      +$5.00

      +$10.00

      -$1.50

      ...

       

      How can I do this The numbers are being loaded into the table with <h:outputText value="#{mybean.transaction}"/> here:

       

      <rich:column>

                                                                                                      <f:facet name="header">Transaction</f:facet>

                                                                                                      <h:outputText value="#{mybean.transaction}"/>

      </rich:column>

       

      so I cannot give style to the numbers seperately. Any help asap is appreciated. Thanks!

       


        • 1. Re: Giving style to a column in Richfaces Datatable based on value in each cell
          healeyb

          Hi, my attention was attracted by your topic heading - think about it. Forget about columns, you are

          trying to style the contents of cells. I think you are looking for a structure like this:

           

          <rich:column>

            <h:panelGroup layout="block"

                                  style="#{var.someProperty == true ? 'border: 2px solid red' : ' ' }">

                  <h:outputText value="some content"/>

            </h:panelGroup>

          </rich:column>

           

          I hope it works.

           

          Spock