7 Replies Latest reply on Oct 1, 2010 6:58 PM by Neil Richardson

    dataList updated by a:commandLink

    Bruno Borges Newbie
      In the following scenario, when a user clicks in a link of the first dataList, the page is supposed to update the second dataList and the first description div. And when the user clicks in a link of the second dataList, the page is supposed to update the second description div.

      It is a simple scenario, but it seems something is not working properly.
      Although the second lists loads correctly and the first div presents the description of clicked item in the first list, this is printed in console:

      16:19:16,506 WARN  [org.jboss.seam.Component] Cannot create Seam component, scope is not active: areaInteresseHome(CONVERSATION)

      Also, if the user clicks on any item of the second list, nothing happens.

      Any help?

      -- XHTML --
      <h:form>
         <h:outputText
           value="Nenhnuma área de interesse cadastrada"
           rendered="#{empty areaInteresseList.resultList}" />

          <rich:dataList
           var="area"
           value="#{areaInteresseList.resultList}"
           rendered="#{not empty areaInteresseList.resultList}" type="disc">
                     <a:commandLink value="#{area.nmAreaInteresse}" reRender="descAreaInteresse,listSubareasInteresse">
                          <f:param name="areaInteresseIdAreaInteresse"
                               value="#{area.idAreaInteresse}" />
                     </a:commandLink>
           </rich:dataList>

           <a:outputPanel id="listSubareasInteresse">
                <a:region>
                     <h:outputText
                          value="Nenhnuma subárea de interesse cadastrada para a área selecionada"
                          rendered="#{empty areaInteresseHome.instance.detalheAreaInteresses}" />

                     <rich:dataList id="subareasList" var="subarea"
                          value="#{areaInteresseHome.detalheAreaInteresses}" type="disc"     
                          rendered="#{not empty areaInteresseHome.instance.detalheAreaInteresses}">
                          <a:commandLink value="#{subarea.nmDetalheAreaInteresse}" reRender="descSubareaInteresse">
                               <f:param name="detalheAreaInteresseIdDetalheAreaInteresse"
                                    value="#{subarea.idDetalheAreaInteresse}" />
                          </a:commandLink>
                     </rich:dataList>
                </a:region>
           </a:outputPanel>

           <strong>Descrição da área:</strong> <br />
           <a:outputPanel id="descAreaInteresse">
                <a:region>
                     <h:outputText
                          value="#{areaInteresseHome.instance.dsAreaInteresse}" />
                </a:region>
           </a:outputPanel>

           <strong>Descrição da Subárea:</strong> <br />
           <a:outputPanel id="descSubareaInteresse">
                <a:region>
                     <h:outputText
                          value="#{detalheAreaInteresseHome.instance.dsDetalheAreaInteresse}" />
                </a:region>
           </a:outputPanel>
      </h:form>


      -- page.XHTML --
      <page login-required="true" xmlns="http://jboss.com/products/seam/pages"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd">

           <param name="areaInteresseFrom" />
           <param name="areaInteresseIdAreaInteresse" value="#{areaInteresseHome.areaInteresseIdAreaInteresse}" />
           <param name="detalheAreaInteresseIdDetalheAreaInteresse"
                value="#{detalheAreaInteresseHome.detalheAreaInteresseIdDetalheAreaInteresse}" />

      </page>

      -- JAVA --
      @Name("areaInteresseHome")
      public class AreaInteresseHome extends EntityHome<AreaInteresse> {

         // seam-gen code

      }

      @Name("detalheAreaInteresseHome")
      public class DetalheAreaInteresseHome extends EntityHome<DetalheAreaInteresse> {

         // seam-gen code

      }