jsf - IF statement does not work inside Primefaces DataTable -
i want show row if have data it. code 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 have data, row not shown. how can implement logic? thanks!
try place condition expression in <p:row>
's tag itself, using 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>
Comments
Post a Comment