Why is the cellEditor not updating correctly?

UI Components for JSF
Post Reply
noderev
Posts: 1
Joined: 25 Oct 2021, 16:31

25 Oct 2021, 16:33

Hi,

I have a table that looks like this:192.168.l.l

Code: Select all

<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" routerlogin

Code: Select all

private boolean disabled;

@PostConstruct
public void init() {
    setDisabled(true);
}

// getter
// setter
CommandLink action:

Code: Select all

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. 192.168.0.1

Thanks in advance.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests