How to skip some rows to be displayed using dataTable:
<h:dataTable cellspacing="0" id="dogs" value="#{dogBean.dogs}" var="dog" rendered="#{dogBeans.dogs != null}">
<h:column id="nameColumn">
<h:outputText value="#{dog.name}"/>
</h:column>
<h:column id="breedColumn">
<h:outputText value="#{dog.breed}"/>
</h:column>
</h:dataTable>
I want to display all dogs, but those how have an age greater than 10.
dog.age > 10.
I’m using Seam.
You can’t do this nicely in the view side. You can at most set the
renderedattribute of every cell contents tofalse, but this doesn’t avoid the<tr>element being rendered. You would see a blank row and its appearance may not be consistent among browsers.Best is to filter the rows beforehand in the (post)construct, action(listener) or maybe lazily in the getter.
Or, just send a new SQL query returning exactly the data you need.