1 2 Previous Next 18 Replies Latest reply on Mar 19, 2010 11:30 AM by Rodrigo Mendoza

    recover values rich:dataTable

    Rodrigo Mendoza Novice

      Hi,

       

      How can I recover the values that are in a rich:dataTable

       

      Like this

       

      <r:dataTable id="listaDetalleRegion" var="iteraDetReg" value="#{detallePedidoBean.listaDetalleRegion}" width="100%"

      onRowMouseOver="this.style.backgroundColor='#ffffff'"

                              onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">

      <f:facet name="header">

      <r:columnGroup>

                                  <r:column>

                                      <h:outputText value="Plaza"/>

                                  </r:column>

                                  <r:column>

                                      <h:outputText id="comisionPorcentaje" value="#{detallePedidoBean.comisionPorcentaje}"/>

                                  </r:column>

                                  <r:column>

                                      <h:outputText id="costoPorcentaje" value="#{detallePedidoBean.costoPorcentaje}"/>

                                  </r:column>

                                  <r:column>

                                      <h:outputText value="Pagina"/>

                                  </r:column>

                                  <r:column>

                                     <h:outputText value="Total Paginas"/>

                                  </r:column>

                                  <r:column>

                                      <h:outputText value="Comentario"/>

                                  </r:column>

      </r:columnGroup>

      </f:facet>

      <r:columnGroup style="width: 100px;">

              <r:column width="20%" style="text-align: center;">

          <h:outputText value="#{iteraDetReg.nombreCiudadRegion}"/>

              </r:column>

              <r:column style="text-align: center;">

      <h:inputText id="proporcionComisionPlaza" value="#{iteraDetReg.proporcionPorcentajePlaza}" styleClass="inputTextPropPlaza" onkeypress="return isNumberKey(event);" 

      onchange="return proporcionComision('#{row}', '#{detallePedidoBean.totalPlazas}')" onkeyup="onlyNumberMaxMin(this.value, this.id);" maxlength="5" required="true">

      <f:convertNumber integerOnly="true" maxFractionDigits="2" maxIntegerDigits="3" minFractionDigits="2" minIntegerDigits="0" type="number" />

      </h:inputText>

              </r:column>

              <r:column style="text-align: center;">

      <h:inputText id="proporcionCostoPlaza" value="#{iteraDetReg.proporcionCostoPorcentajePlaza}" styleClass="inputTextPropCosPlaza" onkeypress="return isNumberKeyDec(event);" 

      onchange="return proporcionCosto('#{row}', '#{detallePedidoBean.totalPlazas}')" maxlength="10" required="true">

      <f:convertNumber integerOnly="true" maxFractionDigits="2" maxIntegerDigits="7" minFractionDigits="2" minIntegerDigits="0" type="number" />

      </h:inputText>

              </r:column>

              <r:column width="10%" style="text-align: center;">

      <r:inputNumberSpinner id="numeroPaginaEdicion" value="#{iteraDetReg.numeroPaginaEdicion}" minValue="0" maxValue="#{iteraDetReg.numeroTotalPaginasEdicionRegion}" oninputkeypress="return stopRKey(event);" cycled="true" required="true">

      <f:convertNumber integerOnly="true" maxFractionDigits="0" maxIntegerDigits="3" minFractionDigits="0" minIntegerDigits="0" type="number"/>

      </r:inputNumberSpinner>

              </r:column>

              <r:column width="10%" style="text-align: center;">

          <r:inputNumberSpinner id="numeroTotalPaginaEdicion" value="#{iteraDetReg.numeroTotalPaginasEdicionRegion}" minValue="0"  maxValue="1000" oninputkeypress="return stopRKey(event);" cycled="true" required="true" onchange="maxValue(this);">

      <f:convertNumber integerOnly="true" maxFractionDigits="0" maxIntegerDigits="3" minFractionDigits="0" minIntegerDigits="0" type="number"/>

      </r:inputNumberSpinner>

              </r:column>

              <r:column width="20%" style="text-align: justify;">

          <h:inputTextarea id="comentarioRegionPlaza" value="#{iteraDetReg.comentarioRegionPlaza}"/>

              </r:column>

              </r:columnGroup>

      </r:dataTable>

       

       

      I’m trying this way but I can not get it, I need to extract the values.

       

       

      org.richfaces.component.html.HtmlDataTable listaDetalleRegion = (org.richfaces.component.html.HtmlDataTable)form.findComponent("listaDetalleRegion");

              //DataTable listaDetalleRegion = (DataTable)form.findComponent("listaDetalleRegion");

              try{

              System.out.println("****proporcionCostoPlaza.getChildren() "+listaDetalleRegion.getChildren());

              for(int i=0; i<listaDetalleRegion.getChildren().size(); i++){

              UIComponent columnas = (UIComponent) listaDetalleRegion.getChildren().get(i);

                  System.out.println(i+" columnas****---> "+columnas.getChildren());

                  System.out.println(" columnas.getChildren().size() "+columnas.getChildren().size());

                  for(int j=0; j<columnas.getChildren().size(); j++){

                  UIComponent renglones = (UIComponent)columnas.getChildren().get(j);

                  System.out.println(i+" - "+j+" renglones****---> "+renglones.getChildren());

                  System.out.println(" renglones.getChildren().size() "+renglones.getChildren().size());

                  for(int k=0; k<renglones.getChildren().size(); k++){

                  UIComponent datos = (UIComponent)renglones.getChildren().get(k);

                      System.out.println(i+" - "+j+" - "+k+" datos****---> "+datos.getChildren().toString());

                      System.out.println(" datos.getChildren().size() "+datos.getChildren().size());

                  }

                  }

              }

              }catch(Exception ex){

              System.out.println("## Error: "+ex);

              }

       

      Thank you

        1 2 Previous Next