In edit mode, I change a value and I click the save button on the page it doesn't keep the new value, If I click anywhere else first on the page then click save it will keep the value. I need it to keep the value if you click save first.
How to work around this issue? I'm using Primefaces 5.2
Thank you
Primefaces datatable cell editing doesn't update
The code is very simple
<p:dataTable id="countsTableID" var="row" rows="10" editable="true" editMode="cell" value="#{establishmentBean.meatMetricRedDtoList}" >
<f:facet name="header">
<h:outputLabel value="Approved" /> <br/>
</f:facet>
<p:column style="white-space: nowrap;text-align:right">
<p:cellEditor >
<f:facet name="output"><h:outputText id="approvedWeightID" value="#{row.approvedWeight}" style=" width:100%;"/></f:facet>
<f:facet name="input">
<p:inputText id="approvedWeightEditID" value="#{row.approvedWeight}" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
<p:commandButton id="saveButtonID" value="#{msg['button.save']}"
action="#{establishmentBean.actionSaveCounts('RED')}"
process="@form"
update="@form" />
If to enter cell into edit mode and edit value and then click Save. The button action is performed but no edited value set in backing bean.
If to add ajax on change event to the p:input element
<p:ajax event="change" process="@this" update="@this"/>
and Then if to click Save the edited value updated in the backing bean but no action method executed.
Thank you.
<p:dataTable id="countsTableID" var="row" rows="10" editable="true" editMode="cell" value="#{establishmentBean.meatMetricRedDtoList}" >
<f:facet name="header">
<h:outputLabel value="Approved" /> <br/>
</f:facet>
<p:column style="white-space: nowrap;text-align:right">
<p:cellEditor >
<f:facet name="output"><h:outputText id="approvedWeightID" value="#{row.approvedWeight}" style=" width:100%;"/></f:facet>
<f:facet name="input">
<p:inputText id="approvedWeightEditID" value="#{row.approvedWeight}" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
<p:commandButton id="saveButtonID" value="#{msg['button.save']}"
action="#{establishmentBean.actionSaveCounts('RED')}"
process="@form"
update="@form" />
If to enter cell into edit mode and edit value and then click Save. The button action is performed but no edited value set in backing bean.
If to add ajax on change event to the p:input element
<p:ajax event="change" process="@this" update="@this"/>
and Then if to click Save the edited value updated in the backing bean but no action method executed.
Thank you.
It makes it easier to see if you use "Code" blocks for your code.
Have you tried the ajax event "cellEdit"?
(See the showcase for an example and documentation)
Have you tried the ajax event "cellEdit"?
(See the showcase for an example and documentation)
PrimeReact: 9.6.0
NextJs: 13.4.12
Theme Apollo v9.0
Database pg 8.8.0
react-hook-form: 7.38.0
NextJs: 13.4.12
Theme Apollo v9.0
Database pg 8.8.0
react-hook-form: 7.38.0
Here is a solution for this issue: https://stackoverflow.com/questions/391 ... uttonclick
-
- Information
-
Who is online
Users browsing this forum: No registered users and 25 guests