Olá!
Estou com o seguinte cenário, tenho um dataTable RichFaces e em cada coluna do meu datatable eu tenho um h:selectBooleanCheckbox.
Estou tentando criar um h:selectBooleanCheckbox no header para selecionar todos caso seja clicado, porém até o momento não consegui. Se algyuém puder dar uma ajuda.
Minha coluna do meu datatable
<rich:column>
<f:facet name="header">
<h:selectBooleanCheckbox id="selectALL" value="#{bean.indicadorCheckAll}">
<a4j:ajax event="click" listener="#{bean.checkTodos}" execute="@this" render="selectALL"/>
</h:selectBooleanCheckbox>
</f:facet>
<h:selectBooleanCheckbox id="select" value="#{bean.selectedClientes[objOri.codigoCliente]}"/>
</rich:column>
** Meu Bean**
public void checkTodos(AjaxBehaviorEvent event) {
if (!getListaClientesOrigem().isEmpty()) {
for (Cliente clientesOrigem : getListaClientesOrigem()) {
if (indicadorCheckAll) {
selectedClientes.put(clientesOrigem, Boolean.TRUE);
} else {
selectedClientes.put(clientesOrigem, Boolean.FALSE);
}
}
}
}
private boolean indicadorCheckAll = false;