DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled

jsf, primefaces

Solution

There are two solutions for this problem:

- Adding rowKey, selection and selectionMode attributes to dataTable

- Implementing SelectableDataModel interface and extending a DataModel like ListDataModel for filling the dataTable

First one is Simpler. Adding `rowKey="#{myEntity.carID}"` to your `p:dataTable` should solve your problem

Problem

I was trying to implement one DataTable Editable with RowSelection enabled. But it is throwing out an exception: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled. I implemented the DataModel in both the object class and the managed bean class but the error is the same. Now only a blank table appears for me. Please help.

Original source

Related problems