Reputation: 43
Do you have any idea how can I use xp:fileDownload control in a xp:repeat control ?
I binded xp:repeat control to view. So I am available to get NotesViewEntry per line.
But I didnt get attachments using var variable in xp:fileDownload control.
I placed xp:repeat in xp:panel and created data document in panel object. I placed fileDownload control inside this panel. And binded document data source to fileDownload.
Not worked !
Have an idea ?
I have 10 documents and every document has one more attachment. I want to show these files using filedownload control.
<xp:this.data>
<xp:dominoView var="viewReviews" viewName="vwLookupGoruslerHepsi"></xp:dominoView>
</xp:this.data>
<xp:repeat id="repeat1" value="#{viewReviews}" var="viewEntry">
<xp:table style="width:100%;border:1px solid #ddd;margin-bottom:5px;"
cellpadding="2">
<xp:tr valign="top">
<xp:td rowspan="5" style="width:250px">
<xp:text id="computedField9" tagName="h4" escape="true">
<xp:this.value><![CDATA[#{viewEntry["GorusBildirecek_CN"]}]]></xp:this.value>
</xp:text>
</xp:td>
</xp:tr>
<xp:tr valign="top">
<xp:td>
<xp:panel id="panelGorusEkler">
<xp:this.data>
<xp:dominoDocument var="docGorus" formName="frmGorus"
action="openDocument" documentId="#{javascript:viewEntry.getNoteID()}">
</xp:dominoDocument>
</xp:this.data>
<xp:text escape="true" id="computedField1"
value="#{docGorus.GorusBildiren_OU1_NAME}">
</xp:text>
<xp:fileDownload rows="30" id="fileDownload3"
var="rowFile" indexVar="rowIndex" value="#{docGorus.Ekler}">
</xp:fileDownload>
</xp:panel>
</xp:td>
</xp:tr>
</xp:table>
</xp:repeat>
Thanks
Alternative Solution fileDownloadLinks in xp:repeat Control
Alternative way to solve this need.
I added a column which includes @AttachmentNames values. (Column Name : $Ekler)
<xp:tr valign="top">
<xp:this.rendered><![CDATA[#{!empty viewEntry["$Ekler"]}]]></xp:this.rendered>
<xp:td>
<xp:repeat id="repeat2" value="#{viewEntry.$Ekler}" var="embeddedFile">
<xp:link escape="true" id="link1" style="margin-right:10px">
<xp:this.text><![CDATA[#{javascript:var aSizes:Array = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
var embedFile:NotesEmbeddedObject = viewEntry.getDocument().getAttachment(embeddedFile);
var calcnr:Number = Math.floor(Math.log(embedFile.getFileSize())/Math.log(1024));
var fSize = (embedFile.getFileSize()/Math.pow(1024, Math.floor(calcnr))).toFixed(2)+" "+ aSizes[calcnr];
return embedFile.getName() + " (" + fSize + ")"}]]></xp:this.text>
<xp:this.value><![CDATA[#{javascript:"/" + facesContext.getExternalContext().getRequestContextPath() + "/xsp/.ibmmodres/domino/OpenAttachment/" + facesContext.getExternalContext().getRequestContextPath() + "/" + viewEntry.getDocument().getUniversalID() + "/Ekler/" + embeddedFile;}]]></xp:this.value>
</xp:link>
</xp:repeat>
</xp:td>
Upvotes: 3
Views: 2268
Reputation: 15729
If you're using a dominoDocument datasource, I'm pretty sure you'll need to set ignoreRequestParam="true" if you're passing a documentId in. Otherwise it looks to the query string parameter. Then the file download should work.
For the second option, is the column set to show multiple values as separate entries? If the repeat is receiving a comma-delimited string value, it won't work: repeats expect a collection, not a single string. Check to make sure your columnValues() property of the NotesViewEntry is multi-value. Even then, I'd expect it to fail if there's only one attachment.
Rather than using a column value, pass the repeat the NotesEmbeddedObject collection retrieved directly from viewEntry.getDocument(). Each element in your repeat will then be a NotesEmbeddedObject.
Upvotes: 1