Hi all,
I resolved the problem by putting the p dialog outside the h form from my datatable and put a h form inside the p dialog
Update a row from datatable in a p dialog : resolved
Please read http://stackoverflow.com/help/mcve and try to create one.
Let me reexplain :
I want to edit datas from a datatable, in my datatable I have a button to edit a selected row, this button opens a dialog.
This dialog will edit the datas from the datatable, there's a button that call a function from a managed bean for editing my table.
Before using p dialog i used simply Xhtml files , in this configuration everything worked fine, but when I use the p dialog instead of using
xhtml files my data are updated well but in the datatable it appears with adding a new row(datas are duplicate)
I'm sure it's a primefaces issue, maybe with the ajax attribut "ajax="false" or ajax="true"
BUTTON TO DISPLAY A DIALOG
P DIALOG : UPDATE AN ELEMENT FROM THE DATATABLE
I want to edit datas from a datatable, in my datatable I have a button to edit a selected row, this button opens a dialog.
This dialog will edit the datas from the datatable, there's a button that call a function from a managed bean for editing my table.
Before using p dialog i used simply Xhtml files , in this configuration everything worked fine, but when I use the p dialog instead of using
xhtml files my data are updated well but in the datatable it appears with adding a new row(datas are duplicate)
I'm sure it's a primefaces issue, maybe with the ajax attribut "ajax="false" or ajax="true"
BUTTON TO DISPLAY A DIALOG
Code: Select all
<p:dataTable
<p:commandButton update=":form:projetMod" oncomplete="PF('projetModDialog').show()"
icon="fa fa-pencil" rendered="#{sessionMB.userChefProjet}" >
<f:setPropertyActionListener target="#{projetMB.projet}" value="#{projet}"/>
</p:commandButton>
</p:dataTable>
Code: Select all
<p:dialog header="Modifier un projet" widgetVar="projetModDialog" modal="true" showEffect="fade" hideEffect="clip"
resizable="true" minimizable="true" maximizable="true" >
<p:outputPanel id="projetMod" >
<h:panelGrid columns="2" cellpadding="4" width="100%" >
<h:outputLabel for="nom" value="Nom" />
<h:inputText id="nom" value="#{projetMB.projet.nom}" >
</h:inputText>
<h:outputLabel for="typeProjet" value="Type" />
<h:inputText id="typeProjet" value="#{projetMB.projet.typeProjet}" >
</h:inputText>
<h:outputLabel for="etatProjet" value="Etat" />
<h:inputText id="etatProjet" value="#{projetMB.projet.etatProjet}" >
</h:inputText>
<h:outputLabel for="prioriteProjet" value="Priorite" />
<h:inputText id="prioriteProjet" value="#{projetMB.projet.prioriteProjet}" >
</h:inputText>
<h:outputLabel for="clientId" value="Id client" />
<h:inputText id="clientId" value="#{projetMB.projet.client.clientId}" >
</h:inputText>
<h:outputLabel for="idFT" value="Id feuille" />
<h:inputText id="idFT" value="#{projetMB.projet.feuilleTemps.idFT}" >
</h:inputText>
</h:panelGrid>
</p:outputPanel>
// P DIALOG : BUTTON WITH ACTION CALLING A FUNCTION FROM A MANAGED BEAN CLASS
<f:facet name="footer">
<h:panelGroup style = "display:block; text-align:center; ">
<p:commandButton action="#{projetMB.updateProjetEnd()}" value="Ok" ajax="false"
style="background-color:#c0d4f9; font-size:14px; margin:3px;" icon="ui-icon-check" >
</p:commandButton>
</h:panelGroup>
</f:facet>
</p:dialog>
-
- Information
-
Who is online
Users browsing this forum: No registered users and 53 guests