开发者

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://c开发者_Go百科ode.google.com/p/primefaces/source/browse/examples/trunk/showcase/src/main/webapp/ui/datatableRowSelectionInstant.xhtml?r=3293


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜