简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM