0

I want to show a row only if I have data for it. The code which i have is:

<p:dataTable id="comments" var="comment"
        value="#{agencyBean.getCommentByAgency(agencyBean.tAgency)}"
        paginator="true" >

        <p:column>  
            #{comment.author.name}  
        </p:column>

        <p:column>
            <c:if test="${not empty comment.positiveComment}">
                <p:row>
                    <p:column>
                        <p:graphicImage library="images" name="positive.png" />
                    </p:column>
                    <p:column>  #{comment.positiveComment}  </p:column>
                </p:row>
                <br />
            </c:if>
        </p:column>
    </p:dataTable>

But nevertheless I have data, the row is not shown. How can i implement this logic? Thanks!

Tot
  • 207
  • 8
  • 25

1 Answers1

3

Try to place the condition expression in the <p:row>'s tag itself, by using its rendered attribute :

<p:column>
    <p:row rendered="#{not empty comment.positiveComment}">
        <p:column>
            <p:graphicImage library="images" name="positive.png" />
        </p:column>
        <p:column>  #{comment.positiveComment}  </p:column>
    </p:row>
    <br />
</p:column>
Omar
  • 1,430
  • 1
  • 14
  • 31