GabrielBB
GabrielBB

Reputation: 2689

Update selection with right click on PrimeFaces DataTable

Im using JSF 2.1 with PrimeFaces. I have a <p:dataTable/> with selection enabled. Everything working as expected but i need it to change the selection in my ManagedBean when i right-click it !

I use:

<p:ajax event="rowSelect" update=":MyComponent"/>

and it works. It updates my components and everything but it doesn't change the selectedEntity in the bean.

I try with <p:ajax event="rowSelect" update="@this"/> but it doesn't work. I think it just set the object to null so... my question is:

What can i do to set the selectedRow in the bean when i right-click a PrimeFaces DataTable ? Thanks.

Upvotes: 0

Views: 7515

Answers (1)

user2354035
user2354035

Reputation:

To use right-click you must use <p:contextMenu> and in your <p:dataTable> add <p:ajax event="contextMenu" update=":MyComponent"/>

more information from here

Upvotes: 1

Related Questions