1 Reply Latest reply on Dec 4, 2009 8:18 AM by Stefan Woerner

    rich:subTable object selection

    Stefan Woerner Newbie

      Hello,


      i'm having some problems with the rich:subTable. I'm getting a list of container objects with some attributes and a list of locked database entries. So i wrote a xthml with a rich:dataTable containing a rich:subTable:



      <rich:dataTable value="#{containerList}" var="cont">
        <rich:column colspan="6">
          <h:outputText value="#{container.name}" />
        </rich:column>
      
        <rich:subTable value="#{cont.lockedEntries}" var="entr" >
          <rich:column>
            <f:facet name="header">
              <h:outputText value="#{messages['css.header.col.id']}" />
            </f:facet>
            <h:outputText value="#{entr.id}" />
          </rich:column>
      
          ... 4 more columns ...
      
          <rich:column>
            <f:facet name="header">
              <h:outputText value="#{messages['css.header.col.actions']}" />
            </f:facet>
            <s:link action="#{containerManager.selectLockedEntry(entr)}" />
              <h:graphicImage value="img/unlock.png" />
            </s:link>
          </rich:column>
        </rich:subTable>
      </rich:dataTable>



      in my backing bean i have the following code:


      @Stateful
      @Scope(ScopeType.CONVERSATION)
      @Name("containerManager")
      public class ContainerListManager implements ContainerListApiLocal
      {
        @DataModel(value = "containerList")
        private List<Container> m_containerList;
      
        @Out(value = "selectedContainer", required = false)
        @DataModelSelection(value = "containerList")
        private Container m_selectedContainer;
      
        @In(value = "selectedLockedEntry", required = false)
        @Out(value = "selectedLockedEntry", required = false)
        private LockedEntry m_selectedLockedEntry;
      
        @Override
        public void selectLockedEntry( LockedEntry lockedEntry )
        {
          m_selectedLockedEntry = lockedEntry;
      
          if ( m_selectedLockedEntry != null )
          {
             m_logger.info( "Selected Entry: " + m_selectedLockedEntry.getName() );
          }
        }
      
        @Factory("containerList")
        @Override
        public void initContainerList()
        {
          if ( null == m_containerList )
          {
            // Load Container...
            m_containerList = getAllContainer();
          }
        }
      
        @Override
        public List<Contaienr> getContainerList()
        {
          return m_containerList;
        }
      
        ...
      }
      


      on my page all containers with their locked entries are displayed fine, but when i click on the link in the last column the parameter entr is always NULL in the method selectLockedEntry( LockedEntry lockedEntry ) in the backing bean.


      how can i get the selected entry injected or passed through there? For a normal dataTable the solution above works fine in my application.


      My Environment:



      • Seam 2.2.0 GA

      • Facelets

      • RichFaces 3.3.2 GA

      • jBoss 4.2.3 GA



      Thank you very much!
      Greetings Stefan