2 Replies Latest reply on Jun 12, 2008 3:18 PM by Sergey Smirnov

    rich:dataTable Different colors for rows?

    Victor Manuel Ojeda Valiente Newbie

      Hi all,

      I want to put a different color in each row according to a property in my bean. Is that possible? If yes, how? I can change the background color of an output text control but I don't know how change the whole row? Any ideas?

      Thanks in advance,

      Victor

      Some code follows

      <rich:dataTable id="operationOrdersList" rows="10"
       value="#{operationOrdersByPriority}" var="operationOrder" width="100%" columnsWidth="7%,5%,16%,14%,16%,12%,11%,9%,10%">
      
       <f:facet name="header">
      
       <rich:columnGroup>
      
       <h:column>
       <h:outputText value="#{messages['number']}" styleClass="columnHeader"/>
       </h:column>
       <h:column>
       <h:outputText value="#{messages['date']}" styleClass="columnHeader"/>
       </h:column>
       <h:column>
       <h:outputText value="#{messages['responsible']}" styleClass="columnHeader" />
       </h:column>
       <h:column>
       <h:outputText value="#{messages['division']}" styleClass="columnHeader" />
       </h:column>
       <h:column>
       <h:outputText value="#{messages['customer']}" styleClass="columnHeader" />
       </h:column>
       <h:column>
       <h:outputText value="#{messages['detail']}" styleClass="columnHeader" />
       </h:column>
       <h:column>
       <h:outputText value="#{messages['followUpStatus']}" styleClass="columnHeader" />
       </h:column>
       <h:column>
       <h:outputText value="#{messages['priority']}" styleClass="columnHeader"/>
       </h:column>
       <h:column>
       <h:outputText value="#{messages['daysLeftToLimitDate']}" styleClass="columnHeader"/>
       </h:column>
      
       </rich:columnGroup>
      
       </f:facet>
      
       <h:column>
       <s:link id="operationOrderNumberId" value="#{operationOrder.operationOrderNumber}" action="#{operationOrdersByPriorityAction.select(operationOrder)}"/>
       </h:column>
       <h:column>
       <h:outputText value="#{operationOrder.operationOrderDate}" style="#{operationOrder.style}">
       <f:convertDateTime dateStyle="short"/>
       </h:outputText>
       </h:column>
       <h:column>
       <h:outputText value="#{operationOrder.responsibleName}" style="#{operationOrder.style}"/>
       </h:column>
       <h:column>
       <h:outputText value="#{operationOrder.divisionName}" style="#{operationOrder.style}"/>
       </h:column>
       <h:column>
       <h:outputText value="#{operationOrder.accountName}" style="#{operationOrder.style}"/>
       </h:column>
       <h:column>
       <h:outputText value="#{operationOrder.description}" style="#{operationOrder.style}"/>
       </h:column>
       <h:column>
       <h:outputText value="#{operationOrder.followUpStatusName}" style="#{operationOrder.style}"/>
       </h:column>
       <h:column>
       <h:outputText value="#{operationOrder.priorityName}" style="#{operationOrder.style}"/>
       </h:column>
       <h:column>
       <h:outputText value="#{operationOrder.daysLeftToLimitDate}" style="#{operationOrder.style}"/>
       </h:column>
      
       <f:facet name="footer">
       <rich:datascroller/>
       </f:facet>
      
       </rich:dataTable>
      


      where sytle is a property in the OperationOrder bean with a value like

      background-color:#FF0000