2011-07-11 76 views
1

我用rich:menuItem来显示rich:modalpanel。丰富的代码:菜单项是如下:rich:modalPanel只出现几秒钟

<rich:menuItem> 
    <a4j:commandLink 
     value="Add Machine" 
     oncomplete="#{rich:component('addMachinePanel')}.show()" 
     reRender="addMachinePanel"> 
    </a4j:commandLink> 
</rich:menuItem> 

和丰富:modalpanel代码

<rich:modalPanel id="addMachinePanel"> 
    <a4j:form> 
     <a4j:commandButton value="Cancel" 
      action="#{adminBean.cleanupMachineToEdit}" 
      onclick="#{rich:component('addMachinePanel')}.hide(); return false;" /> 
    </a4j:form> 
</rich:modalPanel> 

通过上面的代码,丰富的:modalpanel是出现了一两秒钟,然后再次消失。 请帮我找出问题。

感谢

回答

3

默认情况下,submitMode属性为rich:menuItemserver,这将提交表单,彻底刷新页面。

您可以将submitMode更改为ajax以执行ajax表单提交。只有使用reRender属性指定的元素才会刷新,而不是整个页面。

或者,您可以将其更改为none(对于richfaces 3.X)或client(对于richface 4.0),因此没有表单提交。

<rich:menuItem submitMode="ajax"> 
    <a4j:commandLink 
     value="Add Machine" 
     oncomplete="#{rich:component('addMachinePanel')}.show()" 
     reRender="addMachinePanel"> 
    </a4j:commandLink> 
</rich:menuItem> 
+0

谢谢, 它的工作 – user811602