2012-05-31 144 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>