如何隐藏rich:modalPanel对JSF中的Ajax响应

Ume*_*wte 5 jsf richfaces

我在一个应用程序中使用jsf到达面.我正在使用rich:modalPanel弹出阅读一些细节,并在服务器响应后使用a4j命令按钮提交tha面板我想隐藏modalPanel但不知道如何,

我仍然在尝试解决方案,请帮忙

富modalPanel的代码是这样的.

<rich:modalPanel  id="panelID" minHeight="200" minWidth="450" height="200" width="500">
<a4j:commandButton reRender="sampleID" action="#{SomeTestAction}" image="sample-button.gif"/> 
</rich:modalPanel>
Run Code Online (Sandbox Code Playgroud)

小智 5

这很简单,你可以写:

**UPDATED** 
Run Code Online (Sandbox Code Playgroud)

这个解决方案更好,因为你不需要javaScript.

<a4j:commandButton reRender="sampleID" action="#{SomeTestAction}" image="sample-button.gif">
      <rich:componentControl for="panelId" operation="hide" event="onclick" />
 </a4j:commandButton>
Run Code Online (Sandbox Code Playgroud)

或者使用javaScript

<a4j:commandButton reRender="sampleID" action="#{SomeTestAction}" image="sample-button.gif" oncomplete="javascript:Richfaces.hideModalPanel('panelId');"/>
Run Code Online (Sandbox Code Playgroud)

或者您可以提交表单,弹出窗口消失.

<a4j:commandButton reRender="sampleID" action="#{SomeTestAction}" image="sample-button.gif" oncomplete="document.getElementById('Id_form').submit();"/>:
Run Code Online (Sandbox Code Playgroud)

其中" Id_form" - 表示<rich:modalPanel>所显示形式的id .