a4j:jsFunction breaks within composite component
anilarora Aug 23, 2013 12:20 PMAnother composite component issue with RF 4.3.3.Final on Mojarra 2.1.25 on JBoss AS 7.1.3.Final. (Let me know if it makes sense to enter a bug on this...)
My composite component definition:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:a4j="http://richfaces.org/a4j">
<cc:interface/>
<cc:implementation>
<div id="#{cc.clientId}" >
<h:commandLink action="#{tableTestBean.updateTableData()}" ><f:ajax />test inside of composite</h:commandLink>
<a4j:jsFunction name="loadTableDataInside"
immediate="true"
action="#{tableTestBean.updateTableData()}"
onbegin="alert('begin inside');"
oncomplete="alert('end inside');">
</a4j:jsFunction>
</div>
</cc:implementation>
</html>
And my sample xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:test="http://java.sun.com/jsf/composite/test">
<h:form id="mainform">
<h:panelGrid id="panel" >
<h:commandLink action="#{tableTestBean.updateTableData()}" ><f:ajax />test outside of composite</h:commandLink>
<test:commandActionTest/>
<a4j:jsFunction name="loadTableDataOutside"
immediate="true"
action="#{tableTestBean.updateTableData()}"
onbegin="alert('begin');"
oncomplete="alert('end');">
</a4j:jsFunction>
</h:panelGrid>
</h:form>
</ui:composition>
I am testing this out using chrome and manually invoking the javascript. I see the javascript functions being registered. So, if I run loadTableDataOutside(), I see both alerts and I see my updateTableData() action being called. If I run loadTableDataInside(), I do not see both alerts and updateTableData() does not get called.
The commandLink also has an issue. The outside link works, but the inside link does not. If I remove the jsFunction definition from the composite component, then the inside link works.