I have a table that looks like this:
<h:panelGrid>
<p:dataTable id="datatableId" var="obj" value="#{myBean.dataList}" editable="true" editMode="cell" rowKey="#{obj.id}" rowIndexVar="rowindex">
<!-- some other columns -->
<p:column>
<p:cellEditor id="targetEditorId" disabled="#{myBean.disabled}">
<f:facet name="output">
<h:outputText value="#{obj.foo}"/>
</f:facet>
<f:facet name="input">
<p:inputNumber value="#{obj.foo}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<p:commandLink value="edit" process="@this" action="#{myBean.linkAction}" update="datatableId:#{rowindex}:targetEditorId">
</p:column>
</p:dataTable>
</h:panelGrid>
Boolean value disabled is responsible for the value of the cellEditor attribute "disabled":
private boolean disabled;
@PostConstruct
public void init() {
setDisabled(true);
}
// getter
// setter
CommandLink action:
public void linkAction() {
setDisabled(false);
}
So, the problem is that when i click on the commandLink i expect that the cell will be editable, but it doesn't happen. Howewer, if i initially set attribute disabled="#{!myBean.disabled}" - it works (initially the cell is editable. when i click the link - becomes unavailable for editing), but the task requires the opposite. P.S. i know about <p:rowEditor> , but the task involves the use of commandLink to cell-editing