Deleting P:DATATABLE row by delete button against each row

186 Views Asked by At

I have a table and data in it. I have delete and edit button in the last column against each row of table. I want to delete any row from the table pressing Delete button against it. button I need the userId in the row on backend . how can I get that userId from each row on backend.

<h:commandButton id="uDeleteId" value="delete" action="#{saveData.deleteUser()}"/[![enter image description here][1]][1]>
           
1

There are 1 best solutions below

0
On

If you have <p:dataTable var="user", then your row button can call action="#{myBean.deleteUser(user.userId)}, and your deleteUser method signature would be deleteUser(int userId).