Reputation: 374
I'm working now with the <p:ajax>
to update/fill out my components, but when I select the Object in the autoComplete , the ajax don't update my components.
My code in below:
<p:panel header="Actviter le Projet">
<!--############# Chercher le Projet #############-->
<div id="projetCompleteCenter" align="center">
<h:outputLabel value="#{bundle.searchProject} " />
<p:autoComplete id="autoCompleteProjet" forceSelection="true"
minQueryLength="3" value="#{projetMB.projet}"
completeMethod="#{projetMB.completeProjet}" var="projet"
itemLabel="#{projetMB.projet.nomProjet}" dropdown="true" >
<p:ajax update="nomProjet nombreHeure dateDemarrage typeProjet" />
</p:autoComplete>
</div>
<p:separator />
<!--############# Donées du Projet #############-->
<div id="idPanel">
<h:panelGrid columns="2">
<p:outputLabel for="nomProjet" value="#{bundle.nomProjet} " />
<p:inputText id="nomProjet" value="#{projetMB.projet.nomProjet}"
required="true">
<f:validateLength minimum="3" />
</p:inputText>
<p:outputLabel for="nombreHeure"
value="#{bundle.nombreHeuresProjet} " />
<p:inputText id="nombreHeure"
value="#{projetMB.projet.nbHeuresProjet}" required="true">
<pe:keyFilter mask="num" for="nombreHeure" />
</p:inputText>
<h:outputLabel for="dateDemarrage"
value="#{bundle.dateDemarrageProjet} " />
<p:calendar id="dateDemarrage"
value="#{projetMB.projet.dateDebutProjet}" required="true"
pattern="dd/MM/yyyy" showOn="button" navigator="true"/>
<h:outputLabel for="typeProjet" value="Type du projet: " />
<h:selectOneListbox id="typeProjet"
value="#{projetMB.projet.type}">
<f:selectItems value="#{projetMB.typeProjetList}" var="pr"
itemLabel="#{pr.typeLabel}" itemValue="#{pr.typeValue}" />
</h:selectOneListbox>
</h:panelGrid>
</div>
What is wrong ?
Thank you!
Upvotes: 0
Views: 155
Reputation: 4841
As the default event for UIInputs is the valueChange
event, I think that your problem is, that you have not specified the event attribute of p:ajax
. In the showcase they specifiy it explicitly either, so I think that the default event of p:autoComplete
is actually the the "itemSelect"-event. So you would have to specify the "itemSelect"-event explicitly:
<p:ajax event="itemSelect" update="nomProjet nombreHeure dateDemarrage typeProjet" />
Upvotes: 1