I want to select all check box in some groups of checkboxes using PrimeFaces component on top of JSF.
My code is like this:
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
<p:outputLabel value="Confere:" style="font-weight:bold!important" />
<p:selectManyCheckbox
value="#{funcionarioBean.funcionario.permissaoConfere.stringArray}">
<f:selectItem itemLabel="Consulta" itemValue="C" />
<f:selectItem itemLabel="Edição" itemValue="E" />
<f:selectItem itemLabel="Deleção" itemValue="D" />
<f:selectItem itemLabel="Inclusão" itemValue="I" />
<f:selectItem itemLabel="Relatório" itemValue="R" />
<f:selectItem itemLabel="Check All"/>
</p:selectManyCheckbox>
</h:panelGrid>
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
<p:outputLabel value="Visitante:" style="font-weight:bold!important" />
<p:selectManyCheckbox
value="#{funcionarioBean.funcionario.permissaoVisitante.stringArray}">
<f:selectItem itemLabel="Consulta" itemValue="C" />
<f:selectItem itemLabel="Edição" itemValue="E" />
<f:selectItem itemLabel="Deleção" itemValue="D" />
<f:selectItem itemLabel="Inclusão" itemValue="I" />
<f:selectItem itemLabel="Relatório" itemValue="R" />
<f:selectItem itemLabel="Check All"/>
</p:selectManyCheckbox>
</h:panelGrid>
<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">
<p:outputLabel value="Ocorrências:" style="font-weight:bold!important" />
<p:selectManyCheckbox
value="#{funcionarioBean.funcionario.permissaoOcorrencia.stringArray}">
<f:selectItem itemLabel="Consulta" itemValue="C" />
<f:selectItem itemLabel="Edição" itemValue="E" />
<f:selectItem itemLabel="Deleção" itemValue="D" />
<f:selectItem itemLabel="Inclusão" itemValue="I" />
<f:selectItem itemLabel="Relatório" itemValue="R" />
<f:selectItem itemLabel="Check All"/>
</p:selectManyCheckbox>
</h:panelGrid>
I tried with the code posted here but it only works, if you have only one group of checkboxes on the page.