开发者

PrimeFaces Datatable [duplicate]

This question already has answers here: How can I pass selected row to commandLink inside dataTable or ui:repeat? (4 answers) Closed 7 years ago.

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜