Error in Datatable - JSF 2.2 "rowkey" attribute with Primefaces 6.2

Asked

Viewed 185 times

0

I’m a beginner in JSF and I’m having problem with the attribute rowkey datatable.

He just can’t find the reference I put to my attribute var. It’s like the name I put on var only fit the components that are inside the Datatable (<p:column>). Follows the code:

<p:datatable var="p" value="#{controller.listaExemplo}"
 selection="#{controller.linhaSelecionada}" selectionMode="single" rowkey="#{p.id}">
    <p:column ....................
</p:datatable>

Even before I start the server to test, the IDE even warns that the rowkey can’t find the reference I put in.

I searched a lot and found no one with this same problem as mine, searched the documentation of the first faces and also found nothing about.

What should I do? What I did wrong?

  • You use p.id in some column?

  • @Antoniosantos Uso, in the columns the reference to "var" works normally but within the <p:datatable> tag, and all the examples, even the official on the site of the first faces, use the "rowkey" the way I’m trying and it works, at least I think q works pq otherwise they wouldn’t show it as example...

  • How is the object? There is getId() in the object or it is in an interface?

  • @Marcusmartins There is a public getId() that returns the Id of the object that is unique, returns a long pq in the database this id is bigint, and even then rowKey can’t find it, nn can get the reference that I named in the attribute var. But there’s one thing I realized, when I create a <p:datatable> tag and close it (like this <p:datatable .../>) rowKey can get the reference of the var but if I open the tag (so <p:datatable > ... </p:datatable>) rowKey can no longer get the reference. (Obs: sorry for the delay in responding)

  • @Bruno you are using the name rowkey, or was just a mistake when you typed, because I always put rowk="{p id.}".

  • > @Bruno you are using the name rowkey, or was just a mistake when you typed, because I always put rowk="{p.id}". - Miguelcpjava 24/08 at 18:53 (Obs: was sorry for the delay in responding...) @Miguelcpjava is not a typo I’m typing right rowKey="#{categorias.idCategoria}" I don’t know why he’s making this mistake, but it’s not because of a typo, so much so that I downloaded the Primefaces project that he presents at Showcase and was making the same mistake as mine, not to mention that in my friends' pc tbm gives the msmo error but in the internet I did not find anyone with this same problem that

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.