2011-02-14 34 views
1

我想將圖標控件添加到富:面板的標題,是否可以添加這樣的控件。將圖標控件添加到富集:面板

我的意思是像關閉圖標,設置圖標到面板的標題,就像我們可以對模態面板所做的那樣。

我嘗試了同樣的方式,但圖標沒有放在標題中。也想我不能使用rich:componentControl作爲這些圖標,因爲

rich:componentControl僅用於JS函數。

是否可以通過任何方式將icone放在rich:panel header和invoke bean方法中?

問候,

薩蒂亞

回答

2

您可以設置使用<f:facet/>標記面板標題。

例子:

<rich:panel id="myPanel"> 
    <f:facet name="header"> 
    <a4j:commandLink id="myPanelControl" value="Control"/> 
    </f:facet> 

    My panel content. 
</rich:panel> 

如果你想 「關閉」(你的意思是隱藏?)面板,你可以使用jQuery

使用jQuery實例:

<a4j:commandLink onclick="$('#myPanel').hide();"/> <!-- Or show(); --> 

使用顯示器:

document.getElementById(elementId).style.display = 'none' //Or 'block' to show it back 

使用<rich:componentControl/>,但它不是必需的(在這種情況下,與<a4j:commandLink/>)..

<rich:componentControl for="myPanelControl" event="onclick" operation="use jQuery or display here.."/> 

如果你想啊,以執行bean的方法:graphicImage的,使用​​只actiononComplete

<rich:componentControl event="onclick" action="#{...}" onComplete="hide script here"/> 

或者你可以窩內<a4j:commandLink/>

一個圖像
<a4j:commandLink id="myPanelControl" action="#{myBean.executeSomething} value="" onComplete="$('#myPanel').hide()"> 
    <h:graphicImage value="/myImage.jpg"/> 
</a4j:commandLink> 

有關面板的更多信息可以發現herehere