I'm using MyFaces <h:datatable> in JSF2 and I would like to hide rows based on condition like below.
But it seems that my condition doesn't work.
<h:dataTable value="#{myController.persons}" var="person"
styleClass="table table-striped table-lg borderless"
headerClass="table-header borderless header-cell"
rowClasses="table-show-row,table-hide-row"
rowStyleClass="#{person.gender ne 'M'}">
<h:column>
<div>
<div class="">
<f:facet name="header">Name</f:facet>
</div>
<div class="">
#{persone.name}
</div>
</div>
</h:column>
</h:dataTable>
I also tried to use only rowStyleClass but it doesn't work also
rowStyleClass="#{person.gender ne 'M' ? 'table-show-row': 'table-hide-row'}">
any suggestions ?
The answer is pretty simple. There's no
rowStyleClassinh:dataTable.There is only a
rowClassesattribute (docs).You can find
rowStyleClassin data tables from PrimeFaces.