I've scoured the forum and docs trying to figure this out and have been 
unsuccessfull, so hopefully someone can steer me in the right direction.

I have a page that displays a set of dataTable elements.  The scenario is that 
I have a bunch of objects that can be categorized.  The list of categories is 
dynamic.  On the page, I am iterating over each category (using ui:repeat) and 
displaying a dataTable for each category.  The dataTable snippet currently 
looks like:


  | <ui:repeat value="#{allCategories}" var="category">
  |     <rich:dataTable width="100%" var="record" 
value="#{calculationManager.findCalculations(category.id)}">
  |             <rich:column>
  |                     <h:outputText value="#{record.calculation)}"/>
  |             </rich:column>
  |     </rich:dataTable>
  | </ui:repeat>
  | 

The allCategories property is backed by a DataModel, this is fine.  The 
dataTables are being populated by a bean (referenced by calculationManager) 
that contains the following:


  | public List<FinancialCalculation> findCalculations(int categoryId) {
  |     return (List <FinancialCalculation>)em.createQuery("select f from 
FinancialCalculation f where category_id=:c")
  |             .setParameter("c", categoryId)
  |             .getResultList();
  | }
  | 

This is displaying as I want.  However, my next step is that each item in each 
table needs to be clickable (it will take the user to a details page).

There are two options that I've thought of.  First, I can use a commandLink and 
pass an id of the selected item through it, then look up the object in the 
method that is called.  I haven't done it, but can't think of why it wouldn't 
work.  It just doesn't feel "correct".

The second was to switch to using a DataModel to back each table and use the 
DataModelSelection functionality.  This is what I think I should be doing.  The 
problem is, I don't know how to create the DataModel using a factory method 
that needs to take a parameter (ie, make the findCalculations method above be a 
factory).  Alternatively, I could remove the method parameters and add an 
injected property:
@In private Integer categoryId
But then I don't know how to have the proper value injected for each of the 
dataTables.

Did I explain that clearly?  If so, any suggestions?

Thanks!
Matt

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4087602#4087602

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4087602
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to