How to add a row to a Primefaces table?

0

I have a table in primefaces to which I already add some columns, Now what I want is to add rows, and I have the following but it only shows text in the columns and it does not show what I have in the outputLabel, or in what way is it done?

<p:dataTable style="max-width:1900px;max-height:750px;">
                        <p:column  headerText="RFC" >
                            <p:outputLabel value="RUMS907856"/>
                        </p:column>

                        <p:column headerText="NOMBRE">
                            <p:outputLabel value="JUAN"/>
                        </p:column>

                        <p:column headerText="CLAVE">
                             <p:outputLabel value="123"/>
                        </p:column>
                      <p:column  headerText="1" ></p:column>
                      <p:column headerText="2">
                      </p:column>
                      <p:column headerText="3">
                      </p:column>
  </p:dataTable>

This is how it is shown

    
asked by Root93 24.01.2018 в 17:56
source

1 answer

1

What you need to do is associate your table with the Managed Bean or Bean you do it using the property var to associate that variable to your list that you have in the value you put the list that brings your data .

Now for the columns you put the p:outputLabel in the property value as I use the variable you declare above to enter the property of the object

<p:dataTable id="dt_proceso" emptyMessage="No hay procesos encontrados" 
var="proceso" value="#{consultasRecontratacionMB.listProcesos}"
rows="20" paginator="#{consultasRecontratacionMB.listProcesos.size()>20}" 
paginatorPosition="bottom"  style="width: 80%;">

  <p:column headerText="Codigo Proceso" width="5%">
  <p:outputLabel value="#{proceso.idProcesoRecontratacion}"/>
  </p:column>

  <p:column headerText="Año" width="5%">
   <p:outputLabel value="#{proceso.anio}"/>
   </p:column>

</p:dataTable>
    
answered by 24.01.2018 / 18:36
source