2011-05-29 76 views
0

我在我的file.xhtml中使用Primefaces數據表複合體,我想檢索我選擇刪除或修改它的行的ID。有什麼建議嗎?PrimeFaces Datatable

回答

1

在這裏你去火影忍者......

首先,你需要填充的表,進行了ID

多了一個「刪除」列添加到表對象

<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 ?