Dynamic TabView primefaces, tab rendered attribute doesn't work

戏子无情 提交于 2019-12-25 06:39:20

问题


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 .

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?

check my code:

<p:tabView id="tabs" value="#{myBean.list}" var="_item"  orientation="left" style="height:800px!important;" >

        <p:tab title="#{_item}" rendered="#{_item.show}" >

回答1:


Add disabled attribute to your <p:tab> and use this style for hiding tab:

<style>
    #tabs li.ui-state-disabled {
        display: none;
    }
</style>

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" works but it doesn't render content of the tab, not the tab itself.



来源:https://stackoverflow.com/questions/32739961/dynamic-tabview-primefaces-tab-rendered-attribute-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!