0

我需要根据条件显示标签内的标题。

<th class="header"><h:outputText value="#{supplierScorecard.treeItemList[1].m1.header}" /> </th>

这是我当前的代码。要求就像我需要仅当某种 JavaScript 验证存在该值时才显示特定标题。

注意:我在这里没有使用 JSF 数据表,因为表头是单独打印的。

4

2 回答 2

1

我已经将标签放在具有渲染条件的 a4j:outputpanel 中并且工作正常。

<a4j:outputPanel rendered="#{supplierScorecard.treeItemList[1].m4.header ne null}">
                                                <th class="header  treeTableOthers fixed"><h:outputText value="#{supplierScorecard.treeItemList[1].m4.header}" /> </th>
                                                </a4j:outputPanel>

感谢您的更新#erencan

于 2013-04-23T08:28:03.753 回答
0

将您的标签放在 outputPanel 中,然后为 outputPanel 的呈现属性提供条件。

<h:panelGrid id="panel" rendered="#{YOUR_CONDITION}" columns="1">
        <h:panelGroup>           
         <th class="header"><h:outputText value="#{supplierScorecard.treeItemList[1].m1.header}" /> </th>
      </h:panelGroup>
</h:panelGrid>

如果您想通过 javascript 隐藏它,请<th>使用 span 包装标签并动态更改可见性。

<span id="panel">  
    <th class="header"><h:outputText value="#{supplierScorecard.treeItemList[1].m1.header}" /> </th>
</span>

document.getElementById("panel").style.display = "none";
document.getElementById("panel").style.display = "block";
于 2013-04-18T18:38:17.460 回答