3 Replies Latest reply on Jan 24, 2009 2:08 PM by grabher

    individual row color

    grabher

      hi,


      i m using a datatable with richcols.
      i have a userlist.
      there are users who are admin


      how can i make the table-row of a admin-user in a different color?


      something like this in pseudo
      if user equals admin then set rowcolor:green
      else set row
      color:red


      i  d appreciate you help.
      greets from austria

        • 1. Re: individual row color
          ddeneka

          Hi,


          try something like



                 <style  type="text/css">
                      .plain-row {
                          background-color: #FFFFCC;
                      }
                      .vip-row {
                          background-color: #FFFFBB;
                      }
                      .admin-row {
                          background-color: #FFFFAA;
                      }            
                  </style>
          
                  <rich:dataTable  value="#{users}" var="user">
                      <rich:column styleClass="#{user.type}">
                        #{user.id}
                      </rich:column>       
                      <rich:column styleClass="#{user.type}">
                        #{user.name}
                      </rich:column>                     
                  </rich:dataTable>
                  
                  <rich:jQuery selector=".plain" query="addClass('plain-row')"/>
                  <rich:jQuery selector=".vip" query="addClass('vip-row')"/>
                  <rich:jQuery selector=".admin" query="addClass('admin-row')"/>



          but this way you are adding style clesses to each td element instead of adding it to tr


          Regards, Daniel

          • 2. Re: individual row color
            ddeneka

            Ups,


            ofcourse in this example no jquery is needed, just setting the styleClass


            Regards, Daniel

            • 3. Re: individual row color
              grabher
              thx a lot. i did it with the style classes

              <rich:column style="border:1px solid;background-color:#{tuser.admin ? '#fdf6a9':'#e0ffcf'};"></rich>

              greets