p:commandButton只需单击即可执行操作

mey*_*uel 1 primefaces jsf-2

p:commandButton只用一次单击就不执行操作我有下表

                  <p:dataTable id="firmasTabla" var="car" editable="true" editMode="cell" value="#{clientesMB.itemsPersonaFirmanUtil}"  widgetVar="carsTable">  

                        <p:ajax event="cellEdit" listener="#{clientesMB.modiCellPersonaFirma}" update=":form2:growl" />  
                        <p:column headerText="Nro CI" style="width:30%">  
                            <p:cellEditor>  
                                <f:facet name="output"><h:outputText value="#{car.ci}" /></f:facet>  
                                <f:facet name="input"><p:inputText id="modelInput" value="#{car.ci}" style="width:96%"/></f:facet>  
                            </p:cellEditor>  
                        </p:column> 
                        <p:column headerText="Nombre" style="width:60%">  
                            <p:cellEditor>  
                                <f:facet name="output"><h:outputText value="#{car.nombre}" /></f:facet>  
                                <f:facet name="input"><p:inputText id="modelInput2" value="#{car.nombre}" style="width:96%"/></f:facet>  
                            </p:cellEditor>  
                        </p:column> 
                        <p:column style="width:10%">  
                            <p:commandButton id="selectButton256" actionListener="#{clientesMB.deleteSelecPersonaFirmaCliente}" 
                                             icon="ui-icon-trash" title="Eliminar" update="firmasTabla">  
                                <f:setPropertyActionListener value="#{car}" target="#{clientesMB.personaFirmasSelect}" />  
                            </p:commandButton>  
                        </p:column> 
                    </p:dataTable> 
Run Code Online (Sandbox Code Playgroud)

我必须单击两次才能运行该操作,有时是第一次.在backingbean中有以下方法:

    public void deleteSelecPersonaFirmaCliente() throws Exception {
    try {
        boolean b = this.getItemsPersonaFirmanUtil().remove(personaFirmasSelect);
        boolean b1 = b; 
    } catch (Exception e) {
        JsfUtil.addErrorMessage(e, "Error: deleteSelecPersonaFirmaCliente() " + e.getMessage());

    }
}
Run Code Online (Sandbox Code Playgroud)

调试发生时,第一次单击进入方法,但就好像在列表中找不到要删除的对象.然后单击sugundo删除列表对象.

Hid*_*lgo 5

p:commandButton中使用action而不是actionlistener,因为在f:setPropertyActionListener之后执行action

actionlistener第一次执行时,它没有找到你的对象集,因为它在f:setPropertyActionListener完成之前运行,但这并不总是发生.这解释了为什么单击会在某个时间运行.