0 Replies Latest reply on Jun 9, 2011 3:40 AM by manakor

    Sending a callback to a4j:jsFunction oncomplete event

    manakor

      I am trying to make call to JSF functions in my app more dynamic. Instead of static way of writing callback functions to oncomplete event by hand, I wish to send a callback function as a parameter and make it's invoke inside oncomplete event of the function. Here's an example:

      <script type="text/javascript">

           myFunc('myParamValue', function(){

                doThis();

                andDoThis();

           });

      </script>

       

      <a4j:jsFunction name="myFunc" actionListener="#{...}" data="" oncomplete="">

           <f:param name="myParam" />

           <f:param name="callback" />

      </a4j:jsFunction>

       

      I wish to ask if that would be possible by using data attribute of a4j:jsFunction? Something like this:

      ...

      data="#{myBean.callback}"

      oncomplete="if (typeof window[event.data] == 'function') window[event.data]();"

      ...