h:commandLink的oncomplete属性未调用 [英] oncomplete attribute of h:commandLink not invoked

查看:133
本文介绍了h:commandLink的oncomplete属性未调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正与RichFaces 4.5.2一起从JSF 1.2迁移到JSF 2.2.6.遇到oncomplete无法调用的问题. onclick中的JS函数被调用,但oncomplete中的JS不被调用.这是怎么引起的,我该如何解决?

We are migrating from JSF 1.2 to JSF 2.2.6 along with RichFaces 4.5.2. Facing issues with the oncomplete not getting called. The JS function during onclick gets called, but JS in oncomplete does not get called. How is this caused and how can I solve it?

<h:commandLink ... onclick="ed();" oncomplete="cEd(#{rowIndex});">

推荐答案

There is indeed no such attribute in <h:commandLink>. You're most likely confusing with <a4j:commandLink> which does have that attribute.

您基本上有2个选择:

  1. 只需将<h:commandLink>替换为<a4j:commandLink>.

<a4j:commandLink ... oncomplete="oncompleteFunction()" />

  • <f:ajax>嵌套在<h:commandLink>内部的事件处理程序中.

  • Nest a <f:ajax> with an event handler inside <h:commandLink>.

    <h:commandLink ...>
        <f:ajax onevent="oneventFunction" /><!-- No parenthesis! -->
    </h:commandLink>
    

    function oneventFunction(data) {
        if (data.status === "success") {
            oncompleteFunction();
        }
    }
    

  • 将来的提示:只需阅读标签文档.链接在第一段中.

    Hint for the future: just read the tag documentation. Links are in 1st paragraph.

    这篇关于h:commandLink的oncomplete属性未调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆