1 Reply Latest reply on May 18, 2009 3:00 PM by Nick Belaevski

    c:when / c:otherwise in rich:column

    Trevor Flanagan Newbie

      Hi I am using rich:dataTable bound to a list of beans. I have a column value where I have a choice between it being negative or positive number. If it is negative I want (RED TEXT) and if its positive just render as usual. I have tired several different methods to get this choice working including wrapping the column itself in the c:when/c:otherwise, as shown here

       <c:choose>
       <c:when test="#{position.mtmNegative == true}">
       <rich:column id="mtmCol"
       style="text-align:right; color: red"
       label="#{msg['PositionKeeper.MTM']}">
       <f:facet name="header">
       <h:outputText value="#{msg['PositionKeeper.MTM']}" style="font-weight:bold;"/>
       </f:facet>
       <h:outputText value="#{position.pnlSnap}"><f:convertNumber pattern="(###,###,###,##0.00)"/></h:outputText>
       </rich:column>
       </c:when>
       <c:otherwise>
       <rich:column id="mtmCol"
       style="text-align:right;"
       label="#{msg['PositionKeeper.MTM']}">
       <f:facet name="header">
       <h:outputText value="#{msg['PositionKeeper.MTM']}" style="font-weight:bold;"/>
       </f:facet>
       <h:outputText value="#{position.pnlSnap}"><f:convertNumber pattern="###,###,###,##0.00"/></h:outputText>
       </rich:column>
       </c:otherwise>
       </c:choose>
      
      


      I also tried the following -

       <rich:column id="amountCol"
       style="text-align:right;"
       label="#{msg['PositionKeeper.AMOUNT']}">
       <f:facet name="header">
       <h:outputText value="#{msg['PositionKeeper.AMOUNT']}" style="font-weight:bold;"/>
       </f:facet>
       <c:choose>
       <c:when test="#{position.amtNegative == true}">
       <h:outputText value="#{position.ccySnap}" style="color: red"><f:convertNumber pattern="(###,###,###,##0.00)"/></h:outputText>
       </c:when>
       <c:otherwise>
       <h:outputText value="#{position.ccySnap}"><f:convertNumber pattern="###,###,###,##0.00"/></h:outputText>
       </c:otherwise>
       </c:choose>
       </rich:column>
      
      


      neither of the above methods will work for me, can someone else propose another solution or tell me whats wrong with the way I am doing this?