Passing extra parameter to f:ajax onevent function

后端 未结 1 473
一向
一向 2020-12-14 17:58

In my JSF 2.0 (on JBoss AS 7) project, I would like on my ajax submitted forms to display a little icon status triggered on begin and compl

相关标签:
1条回答
  • 2020-12-14 18:44

    Wrap it in an anonymous function wherein you pass it as extra argument.

    <h:commandLink value="do something boy!">
        <f:ajax render="@form" execute="@form" listener="#{myBean.doStuff}"
            onevent="function(data) { showProgress(data, 'extraValue') }" />
    </h:commandLink>
    

    with

    function showProgress(data, extraParam) {
        // Use "data" argument the usual way.
        // The "extraParam" argument will contain "extraValue" in above example.
    }
    
    0 讨论(0)
提交回复
热议问题