I need to show the selectManyCheckbox
list in 4 columns, but the problem is that this component generates a table, so I do not have any idea of how to define the columns.
I am working with PF 3.4, I can't upgrade to PF 4.x. Do you guys have any solution for this?
EDITED
Now i have this in my code
<h:form id="formAdminAccesosXPerfil">
<h:panelGrid title="Accesos" columns="5">
<c:forEach items="#{accesosXPerfilMB.listadoAcceso}" var="availableItem" varStatus="loop">
<h:panelGroup>
<p:selectBooleanCheckbox id="box_#{loop.index}" value="#{accesosXPerfilMB.checkBoxItems[availableItem]}" />
<h:outputLabel for="box_#{loop.index}" value="#{availableItem.nombre}" />
</h:panelGroup>
</c:forEach>
</h:panelGrid>
The Managebean which is @ViewScoped
I changed the method suggested because it did not work for me...
from:
public void save() {
List<E> selectedItems = checkboxItems.entrySet().stream()
.filter(e -> e.getValue() == Boolean.TRUE)
.map(e -> e.getKey())
.collect(Collectors.toList());
// ...
}
to this:
public void guardarAccesos(){
try {
System.out.println("Size: "+getCheckBoxItems().entrySet().size());
for(BpAcceso acceso:getCheckBoxItems().keySet()){
System.out.println("Acceso Seleccionado: "+acceso.getNombre());
}
} catch (Exception e) {
e.printStackTrace();
}
}
But i do not get any selected item on the hashMap. Just to make sure i am using jdk1.6