JSF and primefaces p:booleancheckbox not rendering correctly

时间:2018-06-19 11:10:21

标签: ajax jsf primefaces

I have a strange behaviour in my code that for some reason I'm unable to solve.

I'm using PF4 and mojarra 2.1.28 running on jboss eap 6.4.

Here's the code

    <p:column>
    <f:facet name="header">                     
        <p:selectBooleanCheckbox id="checkAll" value="#{backingBean.allowAll}">
            <p:ajax listener="#{backingBean.confirmAllowAlla}" process="tablaDoc" update="tablaDoc :form1:facesMessages" onstart="mask();" oncomplete="unmask();" />
        </p:selectBooleanCheckbox>                          
        <p:outputLabel for="checkAll" value="Allow all" />  
    </f:facet>
    <p:selectBooleanCheckbox id="checkTipo" value="#{tipoDocumento.allowed}" >
        <f:param name="idTipoDocumento" value="#{tipoDocumento.idTipoDocumento}"/>
        <f:param name="secuencia" value="#{tipoDocumento.secuencia}"/>
        <p:ajax listener="#{backingBean.confirmChange(tipoDocumento)}" process="@this" update="tablaDoc :form1:facesMessages" onstart="mask();" oncomplete="unmask();" />
    </p:selectBooleanCheckbox>
</p:column>

Getters and setters exist, backing bean is invoked as it should... apparently everything works but...

when I click in the booleanCheckbox placed in the header all the other checkboxes should be checked.

First time I click internally everything seems to go ok. Model is updated correctly and my datatable is updated accordingly but for the checks. Visually they are not checked (checked="checked" is missing in the output html) but all the expected behaviour is just fine. A button for each row is enabled/disabled and even if I add a column to display the internal value used for the check it renders the expected value.

If I uncheck the main checkbox and check it again, normal behaviour is restored and the checks for each row start rendering ok (checked="checked is in the output html).

I cannot modify my DTOs so I cannot implement SelectableDataModel from PrimeFaces.

Any ideas?

0 个答案:

没有答案