p:commandButton and update
Posted: 19 Nov 2009, 20:22
I never get it to work the update="miComp" attribute of p:commandButton. Anyone know that i do?
Code: Select all
<h:form prependId="false">
<p:dataTable id="pac" var="paciente"
value="#{pantallaPrincipalMbean.pacientes}" paginator="true"
rows="10" widgetVar="pacientes" selectionMode="single"
selection="#{pantallaPrincipalMbean.seleccion}">
<p:column sortable="true">
<f:facet name="header">
<h:outputText value="Nombre" />
</f:facet>
<h:outputText value="#{paciente.nombre}" />
</p:column>
<p:column sortable="true">
<f:facet name="header">
<h:outputText value="Apellidos" />
</f:facet>
<h:outputText value="#{paciente.apellidos}" />
</p:column>
<p:column sortable="true">
<f:facet name="header">
<h:outputText value="Telefono" />
</f:facet>
<h:outputText value="#{paciente.telefono}" />
</p:column>
<p:column sortable="true">
<f:facet name="header">
<h:outputText value="Nif" />
</f:facet>
<h:outputText value="#{paciente.nif}" />
</p:column>
<p:column sortable="true">
<f:facet name="header">
<h:outputText value="Fecha Nacimiento" />
</f:facet>
<h:outputText value="#{paciente.fechaString}" />
</p:column>
</p:dataTable>
<h:commandLink value="nuevo" onclick="dlg.show()">
</h:form>
<p:dialog header="add Paciente" width="400px" widgetVar="dlg" fixedCenter="true" modal="true"
binding="#{pantallaPrincipalMbean.dialogoPaciente}" >
<h:form prependId="false">
<p:panel id="panelPaciente">
<h:inputHidden value="#{pantallaPrincipalMbean.paciente.id}" />
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="nombre" value="Nombre:" />
<h:inputText id="nombre" value="#{pantallaPrincipalMbean.paciente.nombre}" />
</h:panelGrid>
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="apellidos" value="Apellidos:" />
<h:inputText id="apellidos" value="#{pantallaPrincipalMbean.paciente.apellidos}" />
</h:panelGrid>
<h:panelGrid columns="3" style="margin-bottom:10px">
<h:outputLabel for="fechaNac" value="Fecha de Nacimiento:">
<p:calendar id="fechaNac" value="#{pantallaPrincipalMbean.paciente.fechaNacimiento}" />
</h:outputLabel>
</h:panelGrid>
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="nif" value="NIF:" />
<h:inputText id="nif" value="#{pantallaPrincipalMbean.paciente.nif}" />
</h:panelGrid>
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="telefono" value="Telefono:" />
<h:inputText id="telefono" value="#{pantallaPrincipalMbean.paciente.telefono}" />
</h:panelGrid>
</p:panel>
<h:commandButton value="aceptar" action="#{pantallaPrincipalMbean.addPaciente}" async="true" update="pac" />
</h:form>
</p:dialog>
Code: Select all
<h:form prependId="false">
<p:dataTable id="pac" var="paciente"
value="#{pantallaPrincipalMbean.pacientes}" paginator="true"
rows="10" widgetVar="pacientes" selectionMode="single"
selection="#{pantallaPrincipalMbean.seleccion}">
<p:column sortable="true">
<f:facet name="header">
<h:outputText value="Nombre" />
</f:facet>
<h:outputText value="#{paciente.nombre}" />
</p:column>
<p:column sortable="true">
<f:facet name="header">
<h:outputText value="Apellidos" />
</f:facet>
<h:outputText value="#{paciente.apellidos}" />
</p:column>
<p:column sortable="true">
<f:facet name="header">
<h:outputText value="Telefono" />
</f:facet>
<h:outputText value="#{paciente.telefono}" />
</p:column>
<p:column sortable="true">
<f:facet name="header">
<h:outputText value="Nif" />
</f:facet>
<h:outputText value="#{paciente.nif}" />
</p:column>
<p:column sortable="true">
<f:facet name="header">
<h:outputText value="Fecha Nacimiento" />
</f:facet>
<h:outputText value="#{paciente.fechaString}" />
</p:column>
</p:dataTable>
<h:commandLink value="nuevo" onclick="dlg.show()">
</h:form>
<p:dialog header="add Paciente" width="400px" widgetVar="dlg" fixedCenter="true" modal="true"
binding="#{pantallaPrincipalMbean.dialogoPaciente}" >
<h:form prependId="false">
<p:panel id="panelPaciente">
<h:inputHidden value="#{pantallaPrincipalMbean.paciente.id}" />
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="nombre" value="Nombre:" />
<h:inputText id="nombre" value="#{pantallaPrincipalMbean.paciente.nombre}" />
</h:panelGrid>
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="apellidos" value="Apellidos:" />
<h:inputText id="apellidos" value="#{pantallaPrincipalMbean.paciente.apellidos}" />
</h:panelGrid>
<h:panelGrid columns="3" style="margin-bottom:10px">
<h:outputLabel for="fechaNac" value="Fecha de Nacimiento:">
<p:calendar id="fechaNac" value="#{pantallaPrincipalMbean.paciente.fechaNacimiento}" />
</h:outputLabel>
</h:panelGrid>
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="nif" value="NIF:" />
<h:inputText id="nif" value="#{pantallaPrincipalMbean.paciente.nif}" />
</h:panelGrid>
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="telefono" value="Telefono:" />
<h:inputText id="telefono" value="#{pantallaPrincipalMbean.paciente.telefono}" />
</h:panelGrid>
</p:panel>
<p:commandButton value="aceptar" action="#{pantallaPrincipalMbean.addPaciente}" async="true" update="pac" />
</h:form>
</p:dialog>