ShaunK
ShaunK

Reputation: 1221

RowselectionListener

I have a query about PrimeFaces. Is it possible to implement a RowSelectionListener component that is similar to

<h:commandLink value ="selection" action="#{usuariosGruposBean.selectionOfGroupObject}"> <f:setPropertyActionListener target="#{usuariosGruposBean.grps}" value="#{groups}"/> </h:commandLink>

within a datatable?

Upvotes: 1

Views: 259

Answers (2)

Cristiano Fontes
Cristiano Fontes

Reputation: 5088

You mean for a datatable right ?

if so yes it's possible to do that, you just need to create a method like this

public void onEditRow(RowEditEvent event) {
enter code here
}

and register it in the JSF using something like this inside the DataTable tag

<p:ajax event="rowEdit" update="@this" listener="#{userController.onEditRow}" /> 

here it will update the whole Datatable because of the @this, if you want to update just a few column you could change that to the name of those columns separated by a space

which would look something like this

 <p:dataTable var="user" value="#{userController.allUsers}" id="userTable">                                
  <p:ajax event="rowEdit" update="@this" listener="#{userController.onEditRow}" /> 

   things inside the table

</p:datatable>

Upvotes: 2

flash
flash

Reputation: 6810

I don't know exactly what you're trying to do, but have you looked at the primefaces showcase yet? They have a lot of examples how to build a row selection listener.

Upvotes: 0

Related Questions