oncomplete attribute of h:commandLink not invoked

拜拜、爱过 提交于 2019-12-22 08:59:57

问题


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});">

回答1:


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

You've basically 2 options:

  1. Just replace <h:commandLink> by <a4j:commandLink>.

    <a4j:commandLink ... oncomplete="oncompleteFunction()" />
    
  2. 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.



来源:https://stackoverflow.com/questions/31266604/oncomplete-attribute-of-hcommandlink-not-invoked

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!