What is the need for the rowKey attribute in a datatable format?

I'm new to connectivity. I tried to select rows in a datatable, it shows an error, then I added the rowkey attribute to the datatable, the error was fixed. can anyone tell what is the actual use of the rowkey attribute

+6
source share
1 answer

I quote the PrimeFaces reference:

RowKey must be a unique identifier from your data model and be used with datatable to find the selected rows. You can define this key using the rowKey attribute or by binding a data model that implements org.primefaces.model.SelectableDataModel.

So, if your datatable is given by a set of beans, rowKey should be an attribute that uniquely represents this bean. For example, primaryKey

+13
source

Source: https://habr.com/ru/post/954035/


All Articles