PrimeFaces Datatable [duplicate]
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?
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?
精彩评论