In an XPage app I'm building I will be letting users store documents (as attachments) related to the main document. On the Notes side, these are documents holding the attachment. In the XPage, my plan is for this custom control to exist in a tab of a tabbed panel.
I started out by doing this directly on an XPage so I could get everything in place easily. I created the repeat, put a panel in it and set the panel to have a Domino Doc datasource that it computed from the repeat control's collection name. It worked fine. Then I copied it to a custom control and put it in my (custom control inside an) Xpage. There it doesn't work properly. In troubleshooting, I found that the panel inside of my repeat was using values from the main 'parent' document, not the document it is bound to.
So, if I have this:
<xp:this.data>
<xp:dominoDocument
var="panelDoc"
formName="FileHolder"
action="openDocument"
documentId="#{javascript:fileRowData.getDocument().getNoteID();}">
</xp:dominoDocument>
</xp:this.data>
is should mean that a computed field of: panelDoc.getDocument().getNoteID(); or panelDoc..getNoteID(); would return the NoteID of the document for that entry of the repeat. No, it returns the NoteID of the main document of the entire XPage that the repeat is in (and the panel is inside that repeat).
So, I'm getting this, where document1 is the document the entire XPage is on. As you can see, I can get the NoteID of the entry in each iteratation of the repeat, but when I try to bind my panel to it, no good.
===
repeat entry: AF2 >>document1: ADA
ADA
repeat entry: AF6 >>document1: ADA
ADA
===
I'm not sure what is happening. This works in a stand-alone XPage, but when nested in a custom control or so, it doesn't? I'm not sure what I'm missing here. I've tried computing the panel's Domino doc with the NoteId and the UNID, but neither works. Can someone see my error? My entire cc is below.
Thanks,
Brian
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:panel>
<xp:repeat
id="repeat1"
rows="30"
var="fileRowData"
repeatControls="false">
<xp:this.value><![CDATA[#{javascript:var tview:NotesView = database.getView("Files\\ParentUNID");
var vc:NotesViewEntryCollection = tview.getAllEntriesByKey(document1.getDocument().getItemValueString('origUNID'));
if (vc != null){
return vc;
} else {
return null;
}}]]></xp:this.value>
<xp:text
escape="true"
id="computedField1">
<xp:this.value><![CDATA[#{javascript:"repeat entry: " + fileRowData.getDocument().getNoteID();}]]></xp:this.value>
</xp:text>
  >>
<xp:text
escape="true"
id="computedField5">
<xp:this.value><![CDATA[#{javascript:"document1: " + document1.getNoteID();}]]></xp:this.value>
</xp:text>
<xp:br></xp:br>
<xp:panel
id="nFileHolderPanel"
style="background-color:rgb(192,192,192)">
<xp:this.data>
<xp:dominoDocument
var="panelDoc"
formName="FileHolder"
action="openDocument"
documentId="#{javascript:fileRowData.getDocument().getNoteID();}">
</xp:dominoDocument>
</xp:this.data>
<xp:br></xp:br>
<xp:text
escape="true"
id="computedField2"
value="#{javascript:panelDoc.getDocument().getNoteID();}">
</xp:text>
</xp:panel>
</xp:repeat></xp:panel>
</xp:view>