Update a row from datatable in a p dialog : resolved

UI Components for JSF
Post Reply
superjony
Posts: 15
Joined: 23 Nov 2018, 01:27

08 Mar 2019, 20:21

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
Last edited by superjony on 13 Mar 2019, 18:24, edited 2 times in total.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

08 Mar 2019, 21:21

Please read http://stackoverflow.com/help/mcve and try to create one.

superjony
Posts: 15
Joined: 23 Nov 2018, 01:27

08 Mar 2019, 23:22

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

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>
P DIALOG : UPDATE AN ELEMENT FROM THE 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>

superjony
Posts: 15
Joined: 23 Nov 2018, 01:27

12 Mar 2019, 19:32

Anyone??? please

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

14 Mar 2019, 15:43

Don't edit the question to contain the answer. Please create a new post for it

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 53 guests