1 Reply Latest reply on Dec 10, 2007 6:00 AM by vanyatka

    Problem with rich:dataList inside of rich:dataTable

    vanyatka

      Hi,

      I have a rich:dataList component nested inside rich:dataTable. The problem is that rich:dataList "tl" variable does NOT iterate over the collection, but rather holds the whole collection provided in the value attribute.

      Here is a bit of code:

      <rich:dataTable id="cardList" var="card" value="#{cardList.resultList}"
       rendered="#{not empty cardList.resultList}"
       width="300px"
       >
      
       <h:column>
       <f:facet name="header">Id</f:facet>
       <h:outputText>#{card.id}</h:outputText>
       </h:column>
       <h:column>
       <f:facet name="header">Name</f:facet>
       <s:link id="card" value="#{card.name}" view="/card.xhtml"
       propagation="">
       <f:param name="cardId" value="#{card.id}" />
       </s:link>
       <rich:panel rendered="#{not empty card.tagLinks}">
       <br />
       <h:outputText>Tags: (#{card.tagLinks})</h:outputText>
       <rich:dataList value="#{card.tagLinks}" var="tl">
       <h:outputText value="#{tl}" styleClass="label"></h:outputText>
       </rich:dataList>
       </rich:panel>
       </h:column>
       </rich:dataTable>


      The result of which is as follows:


      Tags: ([mycards.entity.TagLink@753e7a, mycards.entity.TagLink@10bc88b])

      * [mycards.entity.TagLink@753e7a, mycards.entity.TagLink@10bc88b]


      Any suggestions what can be the problem?
      Thanks,


        • 1. Re: Problem with rich:dataList inside of rich:dataTable
          vanyatka

          Ups, my collection is java.util.Set, and it seems that Sets are not automatically wraped, thus in my entity class I need to create something like the following (is such wrapping expensive by the way?)

          @Transient
           public List<TagLink> getTagLinksAsList() {
           return new ArrayList<TagLink>(tagLinks);
           }


          Hope this helps someone,