【问题标题】:Richfaces 4 close two popups on oncompleteRichfaces 4 在 oncomplete 上关闭两个弹出窗口
【发布时间】: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.1JSF 2.0。移除 componentControl 后,XHR 调用成功,但两个弹出窗口仍将保留在显示屏上。这里还有两个指向组件的 VDL 文档的链接。

a4j:commandButton

rich:componentControl

根据componentControl的描述,我的应用程序不应该这样:

该行为允许在目标组件上调用 JavaScript API 函数。在附加了行为的组件上触发定义的事件后调用函数。可以自定义初始化变体和激活事件,并且可以将参数传递给目标组件。

【问题讨论】:

    标签: jsf-2 richfaces el


    【解决方案1】:

    你试过好的语法吗:

    oncomplete="#{rich:component('firstPopup')}.hide();#{rich:component('confirmPopup')}.hide();"
    

    【讨论】:

    • 亚历山大,很好,谢谢。我太信任我的 IDE(IntelliJ)了。它说明了“预期声明”的错误,这使我无法尝试:img221.imageshack.us/img221/9986/idead.png
    • 混合 EL 和 JavaScript 会做一些奇怪的事情......从来没有使用过 IntelliJ,所以不能说太多,但 NetBeans 对此没有问题!
    猜你喜欢
    • 2011-02-16
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多