I am using the following guide to implement many checkboxes into my tool: http://www.primefaces.org/showcase/ui/input/manyCheckbox.xhtml
I have successfully done so, but what I want to happen is I want the checkboxes to be already ticked on display if a user has that role, and not checked if they don't. The idea being, an admin can check/uncheck which roles they want a user to have, with the ones they already have checked.
Here is what I have tried so far:
<p:selectManyCheckbox id="roles" value="#{usersView.selectedRoles}" layout="grid" columns="3">
<f:selectItems value="#{rolesView.roles}" var="role" itemLabel="#{role.name}" itemValue="#{role.name}" />
</p:selectManyCheckbox>
In my usersView
, the selectedRoles
is simply an ArrayList
of all of the roles a user has.
Any help is appreciated.