How to set row level rendering in JSF <h:datatable>
How can i set row level rendering in datatable JSF.
<h:dataTable styleClass="tablesub" border="0" value="#{historyQuestBean.answerMasterList[row].inputTextKeySet}" var="opti开发者_C百科on">
<h:column>
<h:outputText value="#{option.sectionShortName}:"/>
</h:column>
<h:column>
<h:outputText value="#{option.type}:"/>
</h:column>
</h:dataTable>
I want to render only those rows who have status true.
How can I do this?
Easier and Simplest thing is to pass the list of values with status = true
In <h:datatable>
you can give a style class within rowClasses
say renderer
and in that class specify a condition like display:#{option.status==true}?'block':'none'
. This will evaluate the EL and accordingly place the style of that <tr\>
to display or not.
Another option is to use <ui:repeat>
instead of <h:datatable>
, Here you can place rendered condition for the <tr>
.
精彩评论