【问题标题】:JSF tomahawk t:columns conditional renderingJSF tomahawk t:columns 条件渲染
【发布时间】:2016-12-15 10:36:14
【问题描述】:

所以,嗯,我有 JSF 战斧桌

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

我想省略一些列。我无法更改数据模型。列总数不时变化。

试过了

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

但它仍然输出空列。

这个答案不是一个选项: Conditional column rendering

因为我使用t:columns 而不是t:column

当我使用t:columns 时如何省略某些列?

【问题讨论】:

    标签: java jsf jsf-2 conditional tomahawk


    【解决方案1】:

    我添加了 display:none;如果满足条件,则添加到标题和行样式(在这种情况下省略标题名称)。所选列消失。

    <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>
    

    【讨论】:

      猜你喜欢
      • 2012-11-28
      • 2015-06-01
      • 2012-08-31
      • 2012-05-10
      • 2013-01-24
      • 2014-01-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多