2009-07-04 52 views
5

我在一個應用程序中使用了jsf伸手可及的面。我正在使用豐富的:modalPanel彈出閱讀一些細節和提交tha面板使用a4j命令按鈕後,從服務器響應我想隱藏模式面板,但不知道如何,如何在JSF中的Ajax響應中隱藏rich: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> 

回答

5

這是很容易,你可以寫:

**UPDATED** 

該解決方案是更好的,因爲你並不需要的JavaScript。

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

或者用JavaScript

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

或者你也可以提交表單,並彈出消失。

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

其中 「Id_form」 - 就是<rich:modalPanel>中所示形式的ID。

+0

感謝這對我有用.. – 2009-07-05 17:00:05