I have a <p:selectManyCheckbox>
inside <ui:repeat>
, getting it's items from a List of a certain Object Class (provided by <ui:repeat>
-variable) and is supposed to save the chosen items into another List of the same Object Class. But it calls the setter method #{cartBean.setSelectedExtras}
only for the last entry (last iteration of <ui:repeat>
).
<ui:repeat var="item" value="#{category.items}">
<p:selectManyCheckbox id="extraCheckbox" value="#{cartBean.selectedExtras}" layout="pageDirection" converter="omnifaces.SelectItemsConverter">
<f:selectItems value="#{item.items5}" var="extra" itemLabel="#{extra.name}"/>
</p:selectManyCheckbox>
</ui:repeat>
Update:
I changed the above construct just the way BalusC proposed.
Declaration in backing bean is now:
private List<List<Item>> selectedExtras = new ArrayList<List<Item>>();
When I check checkboxes that were created by the first loops of <ui:repeat>
and click the <p:commandButton>
inside the same <h:form>
the setter method of selectedExtras
is not called. When I check the checkboxes created in the last loop of <ui:repeat>
and click the <p:commandButton>
I get an Exception:
javax.el.PropertyNotFoundException: /lightbox-item.xhtml @57,165 value="#{cartBean.selectedExtras[iteration.index]}": null