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:
      <rich:dataTable var="mechOut"
       <f:facet name="header">
       <c:forEach var="#{mechOut}">
       <h:outputLabel value="#{mechOut.rowCount}" />
       <h:outputLabel value="Soma" />
       <h:outputLabel value="Média" />
       <rich:subTable value="#{anamanMatrixMB.equipmentOutput}"
       <c:forEach items="#{mechOut.rowCount}">
       <h:inputHidden value="#{eOut.getIdEquipment}" />
       <h:inputHidden value="#{mechOut.getIdOutput}" />
       valueChangeListener="#{valueChangeEvent method}"
       immediate="true" >
       <f:selectItem itemLabel="0" itemValue="0" />
       <f:selectItem itemLabel="5" itemValue="5" />
       <f:selectItem itemLabel="10" itemValue="10" />
       <h:outputText value="#{sum return method}" />
       <h:outputText value="#{average return method}" />

      Can anyone help?

      Thanks in advance!