简体   繁体   中英

JSF tomahawk t:columns conditional rendering

So, umm, I've got JSF tomahawk table

<t:dataTable ... >
    <t:columns ...>
          ... content to render ...
    </t:columns>
</t:dataTable>

and I want to omit some columns. I can't change data model. Columns total count varies from time to time.

Tried

<t:dataTable ... >
    <t:columns ...>
         <c:if  test="#{condition}">
                ... content to render ...
         </c:if>
    </t:columns>
</t:dataTable>

but it still outputs empty columns.

This answer is not an option: Conditional column rendering

because I use t:columns and not t:column .

How can I omit certain columns when I'm using t:columns ?

I add display:none; to the header and row styles if the condition is met (omitting by the header name in this case). The selected column disappears.

<t:dataTable ... >
    <t:columns var="colH" value="#{dataModel.colHeaders}"  headerstyle="#{colH eq 'frodo'? 'display:none;' : ''}" style="#{colH eq 'frodo'? 'display:none;' : ''}">
          ... content to render ...
    </t:columns>
</t:dataTable>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM