Scope: I want to use a dialog control in a CC with a computed id.
I have a dialog control in a CC. The CC has a custom property "dialogID" and the id of the dialog control is computed:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">
<xe:dialog id="${javascript:compositeData.dialogId}">
EMPTY DIALOG
</xe:dialog>
</xp:view>
My Xpage has is simple. I've set the custom property "dialogId" of my CC to "testId" and put a button on the Xpage which should show the dialog:
<?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" xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:button value="Label" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:getComponent("testId").show()}]]></xp:this.action>
</xp:eventHandler></xp:button>
<xc:ccDialogTest dialogId="testId"></xc:ccDialogTest>
</xp:view>
This is the error message when I click on the button:
Error while executing JavaScript action expression
Script interpreter error, line=1, col=24: Error calling method 'show()' on java class com.ibm.xsp.extlib.component.dialog.UIDialog'
Cannot create a view with the initial tag testid as there is no component that id.
It works when I use a static id for the dialog control.