1 Reply Latest reply on Nov 13, 2009 6:25 AM by Nick Belaevski

    problem in creating a variable size (rows and columns) using

    Gustavo Ludwig Newbie

      Hello all,

      I need to create a <rich:dataTable> that meets the following criteria:

      - row number is given by a variable sized list (no problem here), let me call this number i;
      - column number is given by another variable sized list (let me call this number j) plus two columns (called sum and average);
      - each cell (i x j) will have a <rich:inplaceInput> allowing values 0, 5 and 10;;
      - each i-sum cell will sum all values for the given i-row;
      - each i-average cell will return a calculation of ( i-sum : j ) which is an average, not very problematic also once I know i-sum and j values;


      My first approach to this was a combination of <rich:dataTable> and <rich:subTable> but I have failed to implement it. The code I was able to develop was:
      <a4j:outputPanel>
      <rich:dataTable var="mechOut"
       value="#{anamanMatrixMB.mechanicOutput}">
       <f:facet name="header">
       <rich:columnGroup>
       <c:forEach var="#{mechOut}">
       <rich:column>
       <h:outputLabel value="#{mechOut.rowCount}" />
       </rich:column>
       </c:forEach>
       <rich:column>
       <h:outputLabel value="Soma" />
       </rich:column>
       <rich:column>
       <h:outputLabel value="Média" />
       </rich:column>
       </rich:columnGroup>
       </f:facet>
       <rich:subTable value="#{anamanMatrixMB.equipmentOutput}"
       var="#{eOut}">
       <c:forEach items="#{mechOut.rowCount}">
       <rich:column>
       <h:inputHidden value="#{eOut.getIdEquipment}" />
       <h:inputHidden value="#{mechOut.getIdOutput}" />
       <rich:inplaceSelect
       defaultLabel="..."
       valueChangeListener="#{valueChangeEvent method}"
       immediate="true" >
       <f:selectItem itemLabel="0" itemValue="0" />
       <f:selectItem itemLabel="5" itemValue="5" />
       <f:selectItem itemLabel="10" itemValue="10" />
       </rich:inplaceSelect>
       </rich:column>
       </c:forEach>
       <rich:column>
       <h:outputText value="#{sum return method}" />
       </rich:column>
       <rich:column>
       <h:outputText value="#{average return method}" />
       </rich:column>
       </rich:subTable>
      </rich:dataTable>
      </a4j:outputPanel>
      


      Can anyone help?

      Thanks in advance!
      gtludwig