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