I've a selectable PrimeFaces 3.4.1 datatable:
<p:dataTable value="#{projectAdminisrationMB.selectedUserMemberOfGroups}" var="group1"
rowKey="#{group1.name}" selectionMode="single" selection="#{projectAdminisrationMB.selectedBelongToGroup}">
...
</p:dataTable>
I'm getting this error:
com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback visit Grave: javax.faces.FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled.
But I have already set rowKey as per FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled. How is this caused and how can I solve it?
This can occur when the EL expression in the
rowKeyattribute ever evaluatesnull.Make sure that the
nameproperty of yourGroupinstance is nevernull. Otherwise better use a property representing the autogenerated DB primary key, such as#{group1.id}— if you have one.