I'm using the Primefaces datatable Complex in my file.xhtml and I want to retrieve the ID of the row that I selected to remove it or modify it. Is there any suggestion?
Asked
Active
Viewed 1,129 times
1 Answers
1
Here you go Naruto...
First you you need to populate the table with objects that got id
than add a "delete" column to the table
<p:column headerText="Delete">
<p:commandLink ajax="true" action="#{hoursReportBean.removeEntity}" update="@form" process="@this" styleClass="ui-icon ui-icon-trash">
<f:setPropertyActionListener
target="#{hoursReportBean.selectedHourReportsToDeleteFromTable}"
value="#{hourReport}" />
</p:commandLink>
</p:column>
public String removeEntity(){
...
use the id of the object selectedHourReportsToDeleteFromTable.getId() in order to delete it from the list
...
}
Rasengan?

Daniel
- 36,833
- 10
- 119
- 200