1 Reply Latest reply on Feb 18, 2009 9:49 AM by andrei_exadel

    How can I compare rich:columns variable with rich:subTable v

    repkin

      Hi,
      I am trying to generate a table with dynamic columns, I am iterating header list with rich:columns, and in the rich:columns I am iterating columns values list with subtable, which is not same count with headers, and I need to compare their values and if they are same id, I will print out column value, if not I will print out free cell. I have tried with c:if but most probably they are not in same phase. And I cant compare rich:columns variable with rich:subTable variable.

      
      <rich:columns value="#{controller.dprList}" var="dpr">
       <f:facet name="header">
       <h:outputText value="#{dpr.minimumCredit} - #{dpr.maximumCredit} #{msg[dpr.balanceType.balanceUom]}"/>
       </f:facet>
       <c:set var="found" value="false" scope="page" />
       <rich:subTable var="dpl" value="#{wrapper.dplList}">
       <c:if test='${dpr.dprId == dpl.dpr.dprId}'>
       <c:set var="found" value="true" scope="page" />
       <rich:column>
       <h:outputText value="#{dpl.sellerRateDefault}"/>
       </rich:column>
       </c:if>
       </rich:subTable>
       <c:if test='${found == false}'>
       <h:outputText value="-"/>
       </c:if>
      </rich:columns>
      
      


      Thanks for your suggestions...

        • 1. Re: How can I compare rich:columns variable with rich:subTab

          Hi,

          I can suggest you to move list of columns you want to output in subtable to columns's var instance. So, you should init this list in the bean instead of checking for id comparison on the page.

          So, your code should be like as:

          <rich:columns value="#{controller.dprList}" var="dpr">
          <f:facet name="header">
          <h:outputText value="#{dpr.minimumCredit} - #{dpr.maximumCredit} #{msg[dpr.balanceType.balanceUom]}"/>
          </f:facet>
          <c:chosse>
          <c:when test="#{not empty dpr.dplList}">
          <rich:subTable var="dpl" value="#{dpr.dplList}">
          <rich:column>
          <h:outputText value="#{dpl.sellerRateDefault}"/>
          </rich:column>
          </rich:subTable>
          </c:when>
          <c:otherwise>
          <h:outputText value="-"/>
          </c:otherwise>
          </c:choose>
          </rich:columns>