0

I have this code for my webpage

    <h:form id="formTipoGeneracion"
            enctype="multipart/form-data">
        <p:growl id="mensajesCargaArchivos"
                 showDetail="true"/>
        <p:fileUpload mode="simple"
                      value="#{generador.archivoSeleccionado}"/>
        <br/>
        <p:commandButton value="Agregar"
                         ajax="false"
                         action="#{generador.doAgregarArchivo}"/>
        <p:dataTable id="dtArchivos"
                     var="archivo"
                     emptyMessage="No se ha cargado ningun archivo en el servidor."
                     value="#{generador.archivos}">
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Nombre del archivo"/>
                </f:facet>
                <h:outputText value="#{archivo}"/>
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Quitar archivo?"/>
                </f:facet>
                <p:commandLink value="[  X  ]" update="@form"
                               action="#{generador.doEliminarArchivo(archivo)}"/>
            </p:column>
        </p:dataTable>
    </h:form>

I have a very big doubt, when I have <p:commandLink ... update="@form" .../> the table updates its data correctly but if I have <p:commandLink ... update="dtArchivos" .../> (instead of rendering the whole form just render the DataTable) the information on the table doesn't update.

Why is this happening? Tools: PrimeFaces 3.3, Mojarra 2.1.6, Tomcat 7.0.14 Bean's scope: ViewScope

BRabbit27
  • 6,333
  • 17
  • 90
  • 161
  • Why are you using ajax="false"? What happens if you remove the attribute? – perissf Jun 12 '12 at 17:24
  • I'm using `ajax=false` in the `commandButton` because I'm using a simple upload form (the very basic html tag), and searching on the internet I found that when `mode="simple"` that attrib must be set to false. If I remove it does not upload the file. – BRabbit27 Jun 12 '12 at 17:28
  • I think that the problem is there. With update="dtArchivos" you are using ajax behind the scenes. – perissf Jun 12 '12 at 17:37
  • When I disable ajax for `p:commandButton` it disables ajax for all the form? In the other hand, when I use `update='@form'` doesn't it use ajax too? – BRabbit27 Jun 12 '12 at 17:52

0 Answers0