问题描述
我有一个问题",带有Primefaces中tabView的选项卡组件.我用基于数组的动态选项卡做了一个tabView.
i have a "problem" with a tab component for tabView from Primefaces.I did a tabView with dynamic tabs based on a array.
但是基于该数组中对象的布尔属性,某些选项卡无法呈现.
But some tabs can't be rendered, based on a boolean attribute of the object from that array .
我尝试了render ="="或" false,但没有任何反应(在选项卡上).我使用render ="=" {_ item.show}我尝试使用禁用的功能并且可以正常工作,但这不是我的需要.
I tried rendered="true" or "false" but nothing happens (on tab).I use rendered="#{_item.show}" i tried use disabled feature and works fine, but is not my need.
有人对如何解决这个问题有想法吗?
Someone have an idea to how to solve this issue?
检查我的代码:
<p:tabView id="tabs" value="#{myBean.list}" var="_item" orientation="left" style="height:800px!important;" >
<p:tab title="#{_item}" rendered="#{_item.show}" >
推荐答案
将 disabled
属性添加到您的< p:tab>
并使用以下样式隐藏标签:
Add disabled
attribute to your <p:tab>
and use this style for hiding tab:
<style>
#tabs li.ui-state-disabled {
display: none;
}
</style>
#
之后的值是您的< p:tabView>
clientId,因此,如果它位于诸如< h:form id ="myForm>
,然后只需将选择器更改为 #myForm \:tabs
.
Value after #
is your <p:tabView>
clientId, so if it is in a naming container like <h:form id="myForm">
then just change your selector to #myForm\:tabs
.
rendered ="false"
可以,但是它不会呈现选项卡的内容,而不是选项卡本身.
rendered="false"
works but it doesn't render content of the tab, not the tab itself.
这篇关于动态TabView素面,制表符呈现的属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!