2012-05-31 145 views
1

當我點擊按鈕handler.toggleCreatingTheme()被調用,但outputPanel沒有渲染。當我刷新頁面(f5)時,顯示面板的內容。渲染器的a4j commandButton不起作用;頁面沒有渲染

   <a4j:commandButton styleClass="simple-submit-button" 
        action="#{handler.toggleCreatingTheme()}" 
        rendered="#{!handler.creatingTheme}" 
        value="txt" 
        immediate="true" 
        render="newThemeForm" oncomplete="initEditor()" status="statusWait" /> 

       <a4j:outputPanel id="newThemeForm" ajaxRendered="true" rendered="#{handler.creatingTheme}"> 

這個標籤都在h:form標籤中,只有一個h:form。

我該如何讓頁面自己刷新,所以在單擊按鈕時渲染面板?

回答

1

嵌入newThemeForm另一A4J內:outputPanel和渲染它,而不是重新渲染newThemeForm。這是因爲當試圖渲染它,因爲它是rendered屬性仍然會falsenewThemeForm不會在DOM。 像:

<a4j:outputPanel id="outerPanel> 
<a4j:outputPanel id="newThemeForm" rendered="#{bean.booleanvalue}"> 
</a4j:outputPanel> 
</a4j:outputPanel> 

渲染outerPanel而不是newThemeForm

0

我已嘗試AhamedMustafaM提到的方式,但它並沒有和我一起工作,所以我搜索並嘗試了一小會兒所以最後我要讓它有一種變通方法的工作,這裏是如何

<a4j:commandButton id="clear" value="Clear" action="#{handler.clearData}" immediate="true" > 
    <!-- dummy call just to make it work --> 
    <a4j:actionListener listener="#{ViewerController.test}"/> 
    <f:ajax render="dataGroupPanel"/> 
</a4j:commandButton>