I have such an p:selectManyCheckbox and it works ok:
<p:selectManyCheckbox id="groups" value="#{myBean.selectedGroups}">
<f:selectItems value="#{myBean.myGroups}" var="group" itemValue="#{group.id}" itemLabel="#{group.name}"/>
</p:selectManyCheckbox>
Now I have to convert it to the Tree component (adding Group parent to data), but my PrimeFaces version 3.4.1. doesn't support such a functionality. For better customization I decided to make this selectManyCheckbox manually with html and <ui:repeat>
):
<div id="j_idt25groups" class="ui-scrollpanel ui-scrollpanel-native ui-widget ui-widget-content ui-corner-all" style="height: 200px;">
<table id="groups" class="ui-selectmanycheckbox ui-widget">
<tbody>
<ui:repeat value="#{myBean.myGroups}" var="group" varStatus="status">
<tr>
<td>
<div class="ui-chkbox ui-widget">
<div class="ui-helper-hidden-accessible">
<ui:fragment rendered="#{myBean.selectedGroups.contains(group.id)}">
<input id="groups:#{status.index}" name="groups" type="checkbox" value="#{group.id}"
checked="checked">
</input>
</ui:fragment>
<ui:fragment rendered="#{not myBean.selectedGroups.contains(group.id)}">
<input id="groups:#{status.index}" name="groups" type="checkbox" value="#{group.id}">
</input>
</ui:fragment>
</div>
<div class="ui-chkbox-box ui-widget ui-corner-all ui-state-default">
<span class="ui-chkbox-icon"></span>
</div>
</div>
</td>
<td>
<label for="groups:#{status.index}">#{group.name}</label>
</td>
</tr>
</ui:repeat>
</tbody>
</table>
</div>
Now i have a problem with this code #{prpBean.selectedGroups.contains(group.id)}
:
java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class java.util.Arrays$ArrayList with modifiers "public"
Is it possible to solve this problem? Does it exists an easier way to convert such a structure to the Tree?