Illep
Illep

Reputation: 16851

onRowSelect(SelectEvent event) Method

public void onRowSelect(SelectEvent event) {
   FacesMessage msg = new FacesMessage("Car Selected", ((Car) event.getObject()).getModel());
   FacesContext.getCurrentInstance().addMessage(null, msg);
}

I need to know the following:

  1. When I click on a Row, will this method be called?
  2. Can I display the rows content using this method?

See: http://code.google.com/p/primefaces/source/browse/examples/trunk/showcase/src/main/webapp/ui/datatableRowSelectionInstant.xhtml?r=3293

Upvotes: 0

Views: 5982

Answers (1)

Jim Tough
Jim Tough

Reputation: 15240

This PrimeFaces Showcase example fully covers these cases:
http://www.primefaces.org/showcase-labs/ui/datatableRowSelectionSingle.jsf

To answer your questions:

  1. Yes.
  2. Yes. Set a car attribute in your bean inside this method. Make sure getters and setters are available for your car. Display the car on your page using an Ajax PPR when the row select event happens.

The code in the showcase example I referenced has all the pieces you need to do this.

Upvotes: 1

Related Questions