2011-08-01 73 views
5

我似乎有一個問題,我有一個豐富的:popupPanel上的a4j:commandLink,但操作沒有觸發。 XHTML的如下所示:Richfaces 4 a4j:沒有觸發豐富的commandLink操作:popupPanel

<rich:popupPanel id="rate-panel" modal="true" height="444" width="780" top="60" show="false" onmaskclick="#{rich:component('rate-panel')}.hide()" styleClass="cs-modal"> 
    /**Some html here**/  
    <a4j:commandLink immediate="false" action="#{venueScore.up}" render="rate-panel" styleClass="rate love"> 
    <span>Love it</span> 
    </a4j:commandLink>  
    /**Some more html here**/  
</rich:popupPanel> 

和管理bean如下所示:

@Named("venueScore") 
@ViewScoped 
public class VenueScoreManager extends BaseManager implements Serializable { 
    public void up() { 
    System.out.println("TEST"); 
    //Do something 
    } 
} 

我所做的託管bean @ViewScoped。

我也曾嘗試在commandLink周圍添加一個<h:form>,但是,這比沒有它的情況更少。我其實認爲這是因爲commandLink在<h:form>之內,其中打開popupPanel的鏈接位於其中。

無論如何,有人可以請我指出爲什麼行動不火嗎?

回答

8

好吧,所以我自己修復它。在解決問題後,我發現我只需要在<rich:popupPanel>的內容周圍添加一個<a4j:region>。所以,現在的XHTML看起來是這樣的:

<rich:popupPanel id="rate-panel" modal="true" height="444" width="780" top="60" show="false" onmaskclick="#{rich:component('rate-panel')}.hide()" styleClass="cs-modal"> 
    <a4j:region id="panel-region"> 
    /**Some html here**/  
    <a4j:commandLink immediate="false" action="#{venueScore.up}" render="panel-region" styleClass="rate love"> 
     <span>Love it</span> 
    </a4j:commandLink>  
    /**Some more html here**/  
    </a4j:region> 
</rich:popupPanel> 
+0

你無法相信我花了多少時間試圖找到答案!你是如何達到這個解決方案的? –

+0

@ AmrH.AbdelMajeed - 我可能花的時間和你一樣多。嘗試和錯誤到底我認爲解決了它;) –

+0

Omg謝謝! :-D – Gatekeeper

0

我知道這是一個老問題,但因爲我有完全相同的問題,我花了很多時間來修復它之前,也許它會幫助別人。 首先,我嘗試了上面提出的解決方案,但它沒有奏效。 最後,我發現這個線程: Issues closing rich:popupPanel via show condition, RF 4.0

而且我加入了一個DOMElement屬性我彈出:

<rich:popupPanel 
id="newMailPopup" 
**domElementAttachment="form"** 
...> 

而現在,我A4J:commandLink完美的作品:-)

0

我有同樣的問題,a4j:commandLink 只有在第一次點擊後才能工作 ....把poppanel放在一個表格裏並添加domElementAttachment ...

<h:form id="myform"> 
    <rich:popupPanel id="pop" domElementAttachment="form"> 
     ... 
     <a4j:commandLink /> 
     ... 
    </rich:popupPanel> 
</h:form> 
相關問題