I am trying to make an Editable DataTable by cell in Primefaces, but after an edit of a cell, the event not submitted and my code can't detect the newValue, and there is no error or log in the stack trace
here is my code:
xhtml:
<p:dataTable id="ListC"
value="#{recruitmentProcessMB.candidateListInProcess}"
var="candid" rowKey="#{candid.idCandidate}"
style="border:0px; " editable="true" editMode="cell">
<p:ajax event="cellEdit"
update="ListC"
listener="#{recruitmentProcessMB.onCellEdit}"
/>
<p:column headerText="Date d'entretien">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{candid.interviewDateCandidate}">
<f:convertDateTime type="date" dateStyle="short"
pattern="dd/MM/yyyy" timeZone="Europe/Paris" />
</h:outputText>
</f:facet>
<f:facet name="input">
<p:calendar id="date"
value="#{candid.interviewDateCandidate}"
navigator="true" pattern="dd/MM/yyyy" mask="true" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column id="vRH" headerText="Validation Par RH " disabledSelection="#{candid.currentTask!='InterviewAndValidationByRH'}">
<p:cellEditor >
<f:facet name="output">
<h:outputText
value="#{candid.decisionOfRh}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu id="rhDecision" style="display: inline-block;"
value="#{candid.decisionOfRh}"
disabled="#{candid.currentTask!='InterviewAndValidationByRH'}" >
<f:selectItem itemLabel="Selectionner..." />
<f:selectItem itemLabel="Accepté" itemValue="Accepté"/>
<f:selectItem itemLabel="Refusé" itemValue="Refusé"/>
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
Bean:
public void onCellEdit(CellEditEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
Candidate c = context.getApplication().evaluateExpressionGet(
context, "#{candid}", Candidate.class);
System.out.println("+++++++++++ "+c.getFirstNameCandidate()+" "+c.getNameCandidate());
System.out.println("*********** "+event.getNewValue().toString());
logger.info(c.getInterviewDateCandidate().toString());
}
try to add the attribute immediate="true"
in the in the tag p:ajax and my bean method was called
<p:ajax event="cellEdit"
update="ListC"
immediate="true"
listener="#{recruitmentProcessMB.onCellEdit}"
process="@this"
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With