2015-10-12 54 views
0

我使用的是primefaces 5.2。 我想用動態呈現的選項卡使用accordionpanel。 我XHTML代碼:primefaces accordionpanel選項卡呈現

<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> 

的「existe」值存儲在一個布爾值,我的問題是,它似乎在渲染屬性中從未使用過。 我有這個結果。 tab rendered 我試圖用相同的結果直接寫它:該標籤總是呈現。

你能幫我嗎?

回答

0

它看起來像rendered行爲相同like inp:tabView,它不呈現標籤的內容,但它呈現標籤本身。在你的情況下,這種風格隱藏了沒有渲染/禁用的標籤(你可以省略,之後的內容,但是如果它被禁用,這隱藏了第一個標籤的內容)。

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

p:accordionPanelidp:tabdisabled屬性:

<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> 
+0

確定我只是tryed thisand結果看起來不錯,即使就是它不正是我想要的。 – willyodin