【发布时间】:2013-05-30 19:14:51
【问题描述】:
首先,解释一下我想要实现的目标:
我正在从表单中打开一个弹出面板。此弹出窗口能够打开第二个弹出窗口(确认),然后从服务器调用操作,并在操作完成时关闭两个弹出窗口。
如何在操作完成后关闭两个弹出窗口(ActionListener)?
这是我的两个例子:
<!-- language: lang-html -->
<a4j:commandButton value="execute"
action="#{navigationController.navigateSomewhere}"
actionListener="#{beanController.doSomething}"
render="datatable,navigationDiv">
<rich:componentControl event="click" target="firstPopup, confirmPopup"
operation="hide" />
</a4j:commandButton>
componentControl 似乎禁用了 XHR 调用,这是有意还是无意?
<!-- language: lang-html -->
<a4j:commandButton value="execute"
action="#{navigationController.navigateSomewhere}"
actionListener="#{beanController.doSomething}"
render="datatable,navigationDiv"
oncomplete="#{rich:component('firstPopup')}.hide()
#{rich:component('confirmPopup')}.hide()">
</a4j:commandButton>
很明显,第二个建议不起作用,也没有添加“AND”。顺便说一句,我使用的是 Richfaces 4.3.1 和 JSF 2.0。移除 componentControl 后,XHR 调用成功,但两个弹出窗口仍将保留在显示屏上。这里还有两个指向组件的 VDL 文档的链接。
根据componentControl的描述,我的应用程序不应该这样:
该行为允许在目标组件上调用 JavaScript API 函数。在附加了行为的组件上触发定义的事件后调用函数。可以自定义初始化变体和激活事件,并且可以将参数传递给目标组件。
【问题讨论】: