当在p:column上使用render属性时,不显示p:column标头小平面 [英] p:column header facet is not shown when rendered attribute is used on p:column

查看:532
本文介绍了当在p:column上使用render属性时,不显示p:column标头小平面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个<p:dataTable>.我想有条件地渲染<p:column>,如下所示:

I have a <p:dataTable>. I would like to render a <p:column> conditionally as follows:

<p:dataTable value="#{abcList}" var="abc">
  <p:column rendered="#{headerShow}">
    <f:facet name="header">
      <h:outputText value="header" />
    </f:facet>
    <h:outputText value="#{abc.hijk}" />
  </p:column>
</p:dataTable>

#{headerShow}false时,该列被隐藏. 当#{headerShow}true时,将显示该列,但没有标题. 当我对rendered="true"进行硬编码时,该列将显示为标题.

When #{headerShow} is false, then the column is hidden. When #{headerShow} is true, then the column is shown, but without header. When I hardcode rendered="true", then the column is shown with header.

这是怎么引起的,我该如何解决?

How is this caused and how can I solve it?

推荐答案

<f:facet name="header">对于列名已过时. Primefaces 3.0引入了headerText属性,其功能完全相同.

<f:facet name="header"> is outdated for column names. Primefaces 3.0 introduced the headerText attribute doing exactly the same.

因此,请尝试以下操作:

So try this instead:

<p:column rendered="#{headerShow}" headerText="header">
  <h:outputText value="#{abc.hijk}" />
</p:column>

这篇关于当在p:column上使用render属性时,不显示p:column标头小平面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆