0
votes

i'm using primefaces 5.2 . i want to use an accordionpanel with tabs dynamically rendered. my xhtml code :

<p:accordionPanel value="#{rechercheBean.structures}" dynamic="true" cache="false" var ="structure">
<p:tab title="#{structure.nomStructure} #{structure.existe?'existe':'n existe pas'}" rendered="#{structure.existe}" >
</p:tab>
</p:accordionPanel>

the 'existe' value is stored in a boolean, my problem is that it seemed to be never used in the rendered attribute. I 've got this result. tab rendered I tried to write it the directly with the same result: the tab is always rendered.

Could you please help me?

1

1 Answers

0
votes

It looks like rendered behaves the same like in p:tabView, it doesn't render the content of the tab, but it renders the tab itself. In your case this style hides not rendered/disabled tabs (you can omit what's after , but this hides content of first tab in case it is disabled).

<style>
    #myPanel > h3.ui-state-disabled, #myPanel > div.ui-accordion-content {
        display: none;
    }
</style>

p:accordionPanel with id and p:tab with disabled attribute:

<p:accordionPanel id="myPanel" value="#{rechercheBean.structures}" dynamic="true" cache="false" var ="structure">
    <p:tab title="#{structure.nomStructure} #{structure.existe?'existe':'n existe pas'}" rendered="#{structure.existe}" disabled="#{!structure.existe}" />
</p:accordionPanel>