I have some strange behavior, lets take a look at the following examples:
The first example without any problems:
XPage (with an included datasource)
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.data>
<xp:dominoDocument var="docData"
formName="frmPrototype"
action="openDocument"
documentId="3DEF64BFAD6E1F32C12580B8003CB18F">
</xp:dominoDocument>
</xp:this.data>
<xc:ccModule></xc:ccModule>
</xp:view>
Custom Control "ccModule"
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom">
<xc:ccSubModule></xc:ccSubModule>
</xp:view>
Custom Control "ccSubModule"
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.beforePageLoad><![CDATA[#{javascript:print("beforePageLoad");
print(docData.getDocument().getUniversalID());
print(docData.getItemValueString("Subject"));}]]></xp:this.beforePageLoad>
<xp:this.beforeRenderResponse><![CDATA[#{javascript:print("beforeRenderResponse");
print(docData.getDocument().getUniversalID());
print(docData.getItemValueString("Subject"));}]]></xp:this.beforeRenderResponse>
</xp:view>
Output as expected:
Now the slightly different second example:
In this example the data source was moved to the ccModule
custom control.
XPage
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom">
<xc:ccModule></xc:ccModule>
</xp:view>
Custom Control "ccModule" (with an included datasource)
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.data>
<xp:dominoDocument var="docData"
formName="frmPrototype"
action="openDocument"
documentId="3DEF64BFAD6E1F32C12580B8003CB18F">
</xp:dominoDocument>
</xp:this.data>
<xc:ccSubModule></xc:ccSubModule>
</xp:view>
Custom Control "ccSubModule"
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.beforePageLoad><![CDATA[#{javascript:print("beforePageLoad");
print(docData.getDocument().getUniversalID());
print(docData.getItemValueString("Subject"));}]]></xp:this.beforePageLoad>
<xp:this.beforeRenderResponse><![CDATA[#{javascript:print("beforeRenderResponse");
print(docData.getDocument().getUniversalID());
print(docData.getItemValueString("Subject"));}]]></xp:this.beforeRenderResponse>
</xp:view>
It seems, that now the data source isn't available anymore in the beforerenderrepsone
event?
Any idea what is going on here?