如果列不显示(渲染),JSF datatable可以隐藏列边框 [英] JSF datatable hide column border if column is not displayed(rendered)

查看:534
本文介绍了如果列不显示(渲染),JSF datatable可以隐藏列边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JSF数据表

 <h:dataTable id="memberTable" value="#{bean.pList}" border="0" 
rowClasses="rowEven rowOdd" var="item">
<h:column rendered="#{item.isDisplay == Y}">
<h:outputText value="#{item.visitDate}" >
</h:outputText>
</h:column>
</datatable>

我有更多这样的列根据条件重新生成,当条件为假时,如果我有边界= 1;我看到显示空白单元格。我如何只显示我想要的列,并有其他ie。 render = false不显示空白单元格

I have more such columns that are rendred based on a condition, when the condition is false and if I have the border=1; I see that blank cells are displayed. How can i display only the columns i want and have other ie. rendered=false not display blank cells?

谢谢,
Sai。

Thanks, Sai.

推荐答案

您不能根据特定行的条件渲染整个列。这在技术上没有任何意义。您需要根据父bean的属性来评估条件。

You can't render an entire column based on the condition of a particular row. This makes technically no sense. You need to evaluate the condition based on a property of the parent bean.

<h:dataTable value="#{bean.pList}" var="item">
    <h:column rendered="#{bean.display == 'Y'}">
        <h:outputText value="#{item.visitDate}" />
    </h:column>
</datatable>

移动 public String getDisplay()#{bean} 之后的课程。

请注意,我还修复了EL表达式中的其他错误。您不应该在 get 之前添加属性名称,您应该引用字符串值。你也可以更好地使它成为一个布尔属性。

Note that I also fixed some other mistakes in your EL expression. You shouldn't prefix the property name with is or get and you should quote string values. You can also better make it a boolean property.

private boolean display;

public boolean isDisplay() {
    return display;
}

rendered="#{bean.display}"

这篇关于如果列不显示(渲染),JSF datatable可以隐藏列边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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