fastbob wrote:
Simon,
Thanks for your quick response. Obviously I don't understand the rendering
model sufficiently. This helps.

Yes, what I'm attempting does imply a tight coupling between the
presentation and backing bean, but in this case the backing bean is actually
used just for presentation and delegates to a more general backing bean. So
I can live with this instance.

Is there a preferred JSF pattern for communicating user selection of a
dataTable row back to the server? I've found a number of somewhat crufty
methods (such as on BalusC), but unless I've missed something, none seem
particularly attractive other than f:attribute. But perhaps that's just the
nature of the beast. Any suggestions?

Generally when processing a row the nicest solution is to build any functionality needed onto the row object itself. Suppose the model is normally a list of Person objects but some logic is needed to manipulate a particular person then the model can be changed to a list of PersonHandler objects each of which has a "person" property. In this case, there is no "communication of the user selection" required; the method is invoked *on* the selected object.

An alternative is to set the "binding" attribute on the t:dataTable object, then the callback method that is invoked can call the getRowData method on the datatable to find the row "currently being operated on". It's not so elegant but does work fine.

I think that if you write the commandLink to invoke an ActionListener rather than an action method then the event might also have the appropriate row info but am not sure of the details here.

Regards,


Simon

Reply via email to