I am trying to make the JSF function call in my application more dynamic. Instead of the static way of writing the callback functions to the oncomplete event manually, I want to send the callback function as a parameter and make it call inside the oncomplete event of the function . Here is 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 want to ask if this is possible using the data a4j:jsFunction ? Something like that:
... data="#{myBean.callback}" oncomplete="if (typeof window[event.data] == 'function') window[event.data]();" ...
javascript callback jsf-2 richfaces ajax4jsf
Nik Sumeiko
source share