I got it. But today I changed something which causes that I don't get the 
@DataModelSelection and @DataModelSelectionIndex injected. I always get the 
first item.

But here we go:
@Stateful
  | @Scope(ScopeType.SESSION)
  | @LoggedIn
  | @Name("testactionDeveloper")
  | @Interceptors(SeamInterceptor.class)
  | public class TestactionDeveloperAction implements TestactionDeveloper, 
Serializable {
  |     @PersistenceContext(unitName = "aresDatabase")
  |     private EntityManager em;
  |     
  |     @In @Valid
  |     private User user;      
  |     
  |     @DataModel(scope=ScopeType.PAGE)
  |     private List<Testaction> testactions;
  |     @DataModelSelectionIndex
  |     private int testactionIndex;
  |     @DataModelSelection
  |     private Testaction testaction;
  |     
  |     @In(required=false)
  |     private Release selectedRelease;
  |     
  |     private Long lastSelectedReleaseID;
  |     
  |     private boolean renderSaveButtons;
  |     private String sortColumn = "id";
  |     private boolean ascending=true;
  |     
  |     
  | //  @Factory("testactions")
  |     public List<Testaction> getTestactions() {
  |             renderSaveButtons = true;
  |             if(selectedReleaseChanged() || testactions == null) {
  |                     if(selectedRelease != null) {
  |                             testactions = em.createQuery(
  |                                             "from Testaction where 
TACT_DEV_USR_ID=:dev and TACT_REL_ID=:rel and (TACT_REV_ID is null or 
TACT_REV_ID=9) order by TACT_ID asc"
  |                             ).setParameter("dev", 
user.getID()).setParameter("rel", selectedRelease.getID()).getResultList();
  |                     } else {
  |                             testactions = em.createQuery(
  |                                             "from Testaction where 
TACT_DEV_USR_ID=:dev and (TACT_REV_ID is null or TACT_REV_ID=9) order by 
TACT_ID asc"
  |                             ).setParameter("dev", 
user.getID()).getResultList();
  |                     }
  |                     lastSelectedReleaseID = (selectedRelease == null) ? 
null : selectedRelease.getID();
  |             }
  |             Collections.sort(testactions, new 
TestactionComparator(sortColumn, ascending));
  |             return testactions;
  |     }
  | //getters/setters for sortColumn/ascending omitted

<t:dataTable value="#{testactionDeveloper.testactions}" var="testaction_var" 
rendered="#{not empty testactionDeveloper.testactions}" 
sortColumn="#{testactionDeveloper.sortColumn}" 
sortAscending="#{testactionDeveloper.ascending}">
  |                     <h:column>
  |                             <f:facet name="header">
  |                                     <t:commandSortHeader columnName="id">
  |                                             <h:outputText 
value="#{ares_messages.label_testaction_ID}" />
  |                                     </t:commandSortHeader>
  |                             </f:facet>
  |                             <h:commandLink value="#{testaction_var.ID}" 
action="#{testactionDeveloper.select}" />
  |                     </h:column>
  | <!-- and so on -->

Do you need sth. else?

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3934390


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to