My DataTable
's editMode
is "row"
. So, the user clicks on a pencil icon to start editing a row and then clicks a check-mark icon to confirm and end editing. They do the same for some rows and then click on save button to save all edited rows in one transaction. But, they may click save button before ending editing; in such case I need to stop saving and tell them to end their row editing before save.
The question is how can I find out whether the table is in editing state or not?
My DataTable
is something like this:
<p:dataTable id="myTable"
value="#{myBean.dataModel}"
editMode="row"
editable="true"
var="row"
rowKey="#{row.id}"
rowIndexVar="rowIndex">
<p:column>
<p:rowEditor/>
</p:column>
<p:column headerText="label">
<p:cellEditor>
<f:facet name="input">
<p:inputText value="#{row.label}" />
</f:facet>
<f:facet name="output">
<h:outputText value="#{row.label}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="name" >
<p:cellEditor>
<f:facet name="input">
<p:inputText value="#{row.name}"/>
</f:facet>
<f:facet name="output">
<h:outputText value="#{row.name}"/>
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
By the way, there is a property named editingRow
with its accessors isEditingRow
and setEditingRow
that I expected to be my answer; but, it isn't. It seems that setEditingRow
is never called.
I'm using PrimeFaces 6.1 and JSF 2.2.